I\'m looking for a way to modify properties on a dynamic
C# 4.0 object with the name of the property known only at runtime.
Is there a way to do something l
Paul Sasik answered a similar question at C# 4.0 Dynamic vs Expando... where do they fit?
using System;
using System.Dynamic;
class Program
{
static void Main(string[] args)
{
dynamic expando = new ExpandoObject();
var p = expando as IDictionary;
p["A"] = "New val 1";
p["B"] = "New val 2";
Console.WriteLine(expando.A);
Console.WriteLine(expando.B);
}
}