A Place for C Sharpers/.Netters

I Will do coding till last moment of life-Kiran Patil

Posts Tagged ‘C#3.0’

using Object Initializers with Sub object

Posted by kiranpatils on October 8, 2008

I have Two Entities like as shown below:

Address.cs

image

Employee.cs

image

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 this..here’s the way..

image

and output is:

image

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

Posted in C#3.0 | Tagged: | Leave a Comment »