This blog is moved to
http://amalhashim.wordpress.com

Saturday, January 10, 2009

New in C# 3.0 - Object Initializers

In normal scenario we used to create and initialize object as

Sample sample = new Sample();
sample.Value = "value";
sample.Text = "text";

In C# 3.0 the same can be achieved as

Sample sample = new Sample()
{ Value="value", Text="text" };

No comments: