How to use the command line in C #? I have windows 7. And I do not understand the purpose of the command line.

    1 answer 1

    You can use it in different ways.

    When building the code. Building from the command line using csc.exe :

    csc sample.cs 

    When executing code. Main () and command line arguments .

     public class Sample { public static void Main(string[] args) { Console.WriteLine("Число аргументов = {0}", args.Length); foreach(string s in args) { Console.WriteLine(s); } } } 

    When you run external applications. Process - class .

     Process.Start("notepad.exe");