expandoobject

How do I dynamically generate columns in a WPF DataGrid?

I am attempting to display the results of a query in a WPF datagrid. The ItemsSource type I am binding to is IEnumerable<dynamic>. As the fields returned are not determined until runtime I don't know the type of the data until the query is evaluated. Each "row" is returned as an ExpandoObject with dynamic properties representing the fiel...

How do I pass an ExpandoObject from C# into IronRuby?

Executing the below code gives me the following exception on the last line: InvalidOperationException: "unbound variable: value" var rubyRuntime = Ruby.CreateRuntime(); rubyRuntime.UseFile("HandleMoveRequested.rb"); var engine = rubyRuntime.GetEngine("rb"); dynamic ruby = engine.Runtime.Globals; var handler = ruby.HandleMoveRequested....

Does C# 4.0's ExpandoObject support Prototype-based inheritance?

Does C# 4.0's ExpandoObject support Prototype-based inheritance? If not, why not(was it by design?) and how could this be implemented? If yes, how does it work and differences are there to the way it works in Javascript? ...

Reflect on an ExpandoObject

I have written a nifty function that will accept a system.object, reflect on its properties and serialize the object into a JSON string. It looks like this: public class JSONSerializer { public string Serialize(object obj) Now, I want to be able to do this to serialize a dynamic/ExpandoObject, but because my serializer uses refle...

.NET 4.0 framework dynamic features in VB with Option Strict On?

Is there any way to use the new dynamic features in the 4.0 framework like ExpandoObject in VB.NET without setting Option Strict Off? With C#, you lose type safety only with the variables you specifically declare as dynamic. But with VB, the only way I've found to use these features is with the old Option Strict Off trick that's been in...

ExpandoObject vs. Dictionary from a performance point of view?

A rather simple question really. I'm working on a project where I need to store and retrieve property values dynamically from a kind of context storage. The values will be written now and then and read multiple times. Speed of retrieval is the top priority here, and every nanosecond counts. Usually, I'd simply implement this with a Dic...

C# 4.0 Dynamic vs Expando... where do they fit ?

I am trying to learn all the new goodies that come with C# 4.0. I am failing to understand the differences between the Dynamic and Expando types. From the looks of things it seems like Dynamic is when you want to access variables etc from python scripts etc.Expando seems like a use ful tool when talking with COM/Office objects. I may be ...

Differences between ExpandoObject, DynamicObject and dynamic

What are the differences between System.Dynamic.ExpandoObject, System.Dynamic.DynamicObject and dynamic? In which situations do you use these types? ...

Adding methods to ExpandoObjects

UPDATE The problem is not the code, the problem is that you apparently can't evaluate dynamic objects from the immediate window. I'm trying to tack on methods to an ExpandoObject but not sure how to get it to work. Here's my code: dynamic myObj = new ExpandoObject(); myObj.First = "Micah"; myObj.Last = "Martin"; myObj.AsString = new ...