Skip to content
October 8, 2008 / kiranpatils

using Object Initializers with Sub object

I have Two Entities like as shown below:





Now i want to use Powerful feature of C# 3.0 object initializers. I am using it since few days but with simple types not with complex type like Employee.Address.. but its good to know that c#3.0 also supports this…Thanks to “Anders hejlsberg” for such a nice programming language…anyway lets look how we can do’s the way..


and output is:


My intention of showing output is that the code works 🙂 just kidding… Enjoy the new and powerful features of C#3.0…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: