My favorite trick is using the null coalesce operator and parens to automagically instantiate collections for me.
private IList<Foo> _foo; public IList<Foo> ListOfFoo { get { return _foo ?? (_foo = new List<Foo>()); } } My favorite trick is using the null coalesce operator and parens to automagically instantiate collections for me.
private IList<Foo> _foo; public IList<Foo> ListOfFoo { get { return _foo ?? (_foo = new List<Foo>()); } }