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
329 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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