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
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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