Using csc.exe, the C# Command-Line Compiler : Intrduction « Language Basics « C# / CSharp Tutorial






To create and run programs using the C# command-line compiler:

  1. Enter the program using a text editor.
  2. Compile the program.
  3. Run the program.

Compiling the Program

C:\>csc Example.cs

Prior to running csc.exe, you may need to run the batch file vcvars32.bat, which is typically found in the //Program Files/Microsoft Visual Studio.NET/Vc7/Bin directory.

  1. The name of a C# program is arbitrary
  2. By convention, C# programs use the .cs file extension
1.1.Intrduction
1.1.1.A C# program begins with a call to Main()
1.1.2.Using csc.exe, the C# Command-Line Compiler
1.1.3.The C# Keywords
1.1.4.C# has the following reserved keywords:
1.1.5.Compile csharp source code in command line