Tag Archives: ideas

c# new feature request : AutoInitListsOnFirstUse

Another sugar coating – a compiler should easily generate code for this (?) without any side effects. why force people to do new boiler plate code ?

List<string> myListOfStrings;


This throws NullReferenceException until we do new List<string>();

The probability of it happening is more when this is part of another data class, which we initialized but forgot to look into all hose other initializations we need to do.

In case somebody want to avoid this behavior we should have an attribute to support old behavior.