Solved

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

Posted on 2009-03-31
5
328 Views
Last Modified: 2012-05-06
How can I in a console application check the command line params count and enter command line params  in the IDE
0
Comment
Question by:peter3244
5 Comments
 
LVL 6

Assisted Solution

by:Cebik
Cebik earned 100 total points
ID: 24027023

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

Open in new window

0
 
LVL 18

Accepted Solution

by:
philipjonathan earned 400 total points
ID: 24027053
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
 
LVL 6

Expert Comment

by:Cebik
ID: 24027065
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
 
LVL 2

Expert Comment

by:Causality
ID: 24027067
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
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24027156
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question