Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8780991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:11:21+00:00 2026-06-13T20:11:21+00:00

I am having fun with a couple of errors I am getting in a

  • 0

I am having fun with a couple of errors I am getting in a C# application I am writing.
The error I keep getting is:

  • encrypt and decrypt calls must have a return type
  • Console.WriteLine being used as a method
  • static void encrypt(string[] args) expected class, delegate, interface or struct
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string pw ="", hash =""; //Declare an intialise variables

            if (args.Length < 4) // Test to see if correct number of arguments have been passed
            {
                Console.WriteLine("Please use command line arguments in this format: encrypt -e (or -d) password-to-encrypt-with input-file output-file");
                Environment.Exit(0);
            }

            if (args[1].Length < 10 || args[1].Length > 40) // Test to see if the password is between 10 and 40 characters
            {
                Console.WriteLine("Please use a password between 10 and 40 characters");
                Environment.Exit(0);
            }

            switch (args[0]) //Uses first argument value to drive switch statement (-e or -d)
            {
                case "-e":
                encrypt(string[] args);
                break;

                case "-d":
                decrypt(string[] args);
                break;

                default:
                Console.WriteLine("When using the program please use -e to encrypt and -d to decrypt");
                break;
            }        
        } //End of MAIN

        static void encrypt(string[] args)  //Function to encrypt
        {
            string inputtext =""; //Initialise Varible (Ensure it is empty)
            inputtext=System.IO.File.ReadAllText(args[2]); //Read file in an assign to input text
            return;
        }

        static void decrypt(string[] args)  //Function to decrypt
        {
            string inputtext =""; //Initialise Varible (Ensure it is empty)
            inputtext=System.IO.File.ReadAllText(args[2]); //Read file in an assign to input text
            return;
        }
    }  
}

Any help would be much appreciated!
Alistair

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:11:22+00:00Added an answer on June 13, 2026 at 8:11 pm

    When calling a method, you must not specify the types of the arguments. So:

            case "-e":
            encrypt(args);
            break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am beginning some experimentation in writing a kernel and having fun doing it.
I'm having a fun issue, I have LiveReload working in Chrome, so I know
I’m having fun with EF and have come unstuck. Originally I used the following
Thanks to a suggestion from Chas. Owens , I have been having fun playing
Say if I want to return the result having fun of the triple. I
New to WordPress in general, been having fun playing about with themes. I have
I have connected Oracle to Access, and I have been having fun creating pivot
I am having fun with WPF and got a problem. I have googled and
I am somewhat new to jQuery but have been having fun trying learn about
I'm having a littl fun with ASP.Net data binding today, basically I have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.