Is there an easy way to merge C# dynamic objects

Posted by ajma on Stack Overflow See other posts from Stack Overflow or by ajma
Published on 2011-02-26T23:13:53Z Indexed on 2011/02/26 23:24 UTC
Read the original article Hit count: 236

Filed under:
|

Let's say I have two dynamic objects like this:

var objA = new { test = "test", blah = "blah" };
var objB = new { foo = "foo", bar = "bar" };

I want to combine them to get:

new { test = "test", blah = "blah", foo = "foo", bar = "bar" };

I won't know what the properties are for both objA and objB at compile time. I want this to be like jquery's extend method.

Anybody know of a library or a .net framework class that can help me do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about dynamic