1. Create Object of class
2. Assign values to its properties
But with object initializer we can do it in single line as follows
What does collection initializer do?
Just like Object initializer it will reduce the work of a developer. It will let us create an instance of any collection class and assign one or more elements to it in the same line.
This is how we normally work,
1. Create instance of collection class.
2. Add elements to it
But with collection initializer we can do it in single line.
For technical trainings on various topics like WCF, MVC, Business Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to contact SukeshMarla@Gmail.com or visit www.sukesh-marla.com
For more stuff like this, click here. Subscribe to article updates or follow at twitter @SukeshMarla
Also do not forget to visit http://www.questpond.com for step by step, technical video & trainings.