Click here to Skip to main content
15,947,476 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Following is code from [^]. I am trying to display command line args A B C D but nothing is

// Hello3.cs
// arguments: A B C D
using System;

public class Hello3
   public static void Main(string[] args)
      Console.WriteLine("Hello, World!");
      Console.WriteLine("You entered the following {0} command line arguments:",
         args.Length );
      for (int i=0; i < args.Length; i++)
         Console.WriteLine("{0}", args[i]); 
austinbox 11-Dec-13 22:35pm    
How are you calling your program?
Sergey Alexandrovich Kryukov 11-Dec-13 22:50pm    
Can you at least see "Hello, World!"?

1 solution

Everything looks correct. If you don't see the arguments, I bet you did not enter any. Perhaps you don't know what is it; this is the only explanation I can think of. Your comment "arguments: A B C D" looks suspicious: what makes you thinking that the arguments are "A B C D"?

So, make sure you understand it; please read:[^].

Ignore all these rules of using -, / or anything like that. To be shown by your code, it could be any string entered after the name of the file of your main executable module of your application assembly.

Share this answer
TnTinMn 11-Dec-13 23:39pm    
You may also want to tell him how to enter the arguments on the Debug Tab under Project->Properties as he is probably running through the IDE.
Sergey Alexandrovich Kryukov 11-Dec-13 23:55pm    
Yes, of course. Thank you for the good point. It's in Project's Properties / Debug tab...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900