A Trivial Console Application

By far the simplest managed code application that can be written in C# is one that doesn’t do anything useful. The following is only of academic interest, yes, but we have to start somewhere:

class Program{    static void Main()    {    }}

Main is the managed code entry-point method for our application. Its body, delimited by curly braces, contains the statements that get executed by the application. In this case, our method body is empty.

Note: Case Sensitivity

Notice the casing of the Main method, with its first character uppercase. C# is a case-sensitive language, just like other C derivatives such as C++ and Java. In other words, method names that differ only in case denote different methods; so main and Main ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.