What is ExpandoObject?

Posted by Kundan64 under C# on 1/29/2013 | Points: 10 | Views : 1216 | Status : [Member] | Replies : 4
Pls tell me what is ExpandoObject and what its use?




Responses

Posted by: Satyapriyanayak on: 1/29/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Refer

http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject.aspx
http://www.c-sharpcorner.com/Blogs/9439/expandoobject-in-C-Sharp-4-0.aspx
http://www.codeproject.com/Articles/62839/Adventures-with-C-4-0-dynamic-ExpandoObject-Elasti

If this post helps you mark it as answer
Thanks

Kundan64, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Senthilstayss on: 3/28/2013 [Member] Starter | Points: 25

Up
0
Down
By using 'Expando' objects we can enable your custom classes to be consumed in dynamic languages. So you can create an object of 'Expando' class and pass to dynamic languages like ruby, javascript, python etc. 'Expando' objects helps to add properties on fly.

using System.Dynamic;

We then create the object of 'ExpandoObject' and assign it to an object which created from 'Dynamic' class type. Please note if we have used 'Dynamic' objects and not expand objects as we still do not know what properties are going to be created during runtime.

dynamic obj = new ExpandoObject();

For creating dynamic property we just need to write the property name and set the value.

obj.Name = "Some Name";

Finally we display the value.

MessageBox.Show(obj.Name);

Senthil D

Kundan64, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja_89 on: 4/5/2013 [Member] Starter | Points: 25

Up
0
Down
Hai
It is used to set arbitrarily set properties onto an object at run time

It is added in Net Framework 4.0


Kundan64, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/5/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
http://stackoverflow.com/questions/1653046/what-are-the-true-benefits-of-expandoobject
http://www.codeproject.com/Articles/62839/Adventures-with-C-4-0-dynamic-ExpandoObject-Elasti
http://www.c-sharpcorner.com/Blogs/9439/expandoobject-in-C-Sharp-4-0.aspx

Mark as Answer if its helpful to you

Kundan64, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response