C# Collection Initializers enable you to add items in the collection at the time of instantiation of the collection. Collection can be a List or Dictionary or any other available C# collection. Till C# 2.0, for creating a collection of Employees we normally do Assuming that there is an overloaded constructor for the Employee class.Here […]
C# 3.0 Object Initializers
Object Initializer, a new technique to initialize an object of a class or collection, was introduced in the .NET 3.5 release (C# 3.0). Object Initializer in C#.NET C# Object Initializers allow you to initialize the object members without an overloaded constructor or without setting the properties after object creation. This means the initial value of […]