Information Technology Reference
In-Depth Information
Main: The Starting Point of a Program
Every C# program must have one class with a method (function) called Main . In the
SimpleProgram program shown previously, it was declared in a class called App .
The starting point of execution of every C# program is at the first instruction in Main .
￿
￿The name Main must be capitalized .
The simplest form of Main is the following:
￿
static void Main( )
{
Statements
}
Whitespace
Whitespace in a program refers to characters that do not have a visible output character.
Whitespace in source code is ignored by the compiler, but is used by the programmer to make
the code clearer and easier to read. Some of the whitespace characters include the following:
￿Space
￿Tab
￿
New line
￿
Carriage return
For example, the following code fragments are treated exactly the same by the compiler in
spite of their differences in appearance:
// Nicely formatted
Main()
{
Console.WriteLine("Hi, there!");
}
// Just concatenated
Main(){Console.WriteLine("Hi, there!");}
Search WWH ::




Custom Search