C# Compiler Optimizations
With the advent of generic support in the C# language appearing in the .NET Framework 2.0 developers have new leverage for writing code that can be reused without compromising type safety.
The C# Compiler for .NET version 2.0 has added field initializer optimizations to avoid generating IL to explicitly set types to their default values. This includes literal values as well as any constant expression whose result is the type’s default.
private int i1 = 0; // the default value for integral types is zero
private int i2 = new int(); // … the parameterless constructor also yields
// the default value for value types
private int i3 = default(int); // … the new default(T)syntax in VS 2005
private int i4 = 1 – 1; // … but also constant expressions
private string s1 = null; // … null is the default value for reference types
private string s2 = default(string); // … which can also be written as default(T)
private string _userName = default(string);
private string _machineName = default(string);
private int _maxThreads = default(int); private int _numberOfCurrentThreads = default(int);To read more about this optimization, look at Peter Hallam’s Blog.For some more reading : Introducing Leverage code reuse




