Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

How can I in a console application check the command line params count and enter command line params in the IDE

How can I in a console application check the command line params count and enter command line params  in the IDE
0
peter3244
Asked:
peter3244
2 Solutions
 
CebikCommented:

Console.WriteLine("Args count {0}", args.Length);
            Console.Write("\nEnter word: ");
            string result = Console.ReadLine();
            Console.WriteLine("\n" + result);

Open in new window

0
 
philipjonathanCommented:
To check command line params count: As answered by Cebik.

To enter command line params in the IDE:
1. Right click on the project in Solution Explorer.
2. Choose Properties
3. Navigate to "Debug" -> "Start options" -> "Command line arguments"
4. Key in your command line params there
5. Save the properties.
0
 
CebikCommented:
Thank's philipjonathan..
I was looking for it :)

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            foreach (string s in args)
                Console.WriteLine(s);
 
            Console.WriteLine("\nArgs count {0}", args.Length);
        }
    }
}

Open in new window

0
 
CausalityCommented:
IN CODE
private static void Main(string[] args)
{
     if (args.Length > 0)
}
IN IDE >
Go to the Project->Properties,
Select Debug from left tab Menu ..
You have a "Command line arguments" option
 
0
 
Éric MoreauSenior .Net ConsultantCommented:
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now