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
327 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 69

Expert Comment

by:Éric Moreau
ID: 24027156
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

26 Experts available now in Live!

Get 1:1 Help Now