#6 – An Even Smaller C# Program

In The Smallest Possible C# Program, I mentioned a couple things as optional.  For the record, here’s the absolute smallest C#.NET program that you can write.  (Assuming that you don’t need it to actually do anything).

class Program
{
    static void Main()
    {
    }
}

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

2 Responses to #6 – An Even Smaller C# Program

  1. Mark Kane says:

    you could shorten the class name and get rid of whitespace for a even “shorter” program

    • Sean says:

      That’s technically true, that you could remove whitespace and shorten the class name. But choosing meaningful names and properly formatting your code is important for purposes of maintainability. Also, the resulting program would not be any shorter, in terms of the number of elements and the resulting IL. The point of this post was to look at the core elements of a C# program, from a semantic point of view, rather to use the smallest number of characters for some reason.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers