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.

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 are ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.