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
326 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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
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 69

Expert Comment

by:Éric Moreau
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now