Expando Object in CSharp

Expando Object

Once you create an instance of an Expando Object which is in the System.Dynamic namespace   then you have ability to arbitrarily add things to these object.

In the below code snippets I have create a new instance of ExpandoObject and add one property and method and then invoke that method.

dynamic expando = new System.Dynamic.ExpandoObject();
expando.Name = "Jameel";
expando.Display = new Action(() => Console.WriteLine(expando.Name));
expando.Display();

Output : Jameel

Enjoy Programming…

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s