Skip to content

Instantly share code, notes, and snippets.

@luodaoyi
Created May 24, 2017 01:06
Show Gist options
  • Save luodaoyi/08198c5e057c23f5dc44e92ab507e931 to your computer and use it in GitHub Desktop.
Save luodaoyi/08198c5e057c23f5dc44e92ab507e931 to your computer and use it in GitHub Desktop.
```
Dictionary<string, object> temp = new Dictionary<string, object>();
temp.Add("Name", "金朝钱");
temp["Age"] = 31;
temp["Birthday"] = DateTime.Now;
dynamic obj = new System.Dynamic.ExpandoObject();
foreach (KeyValuePair<string, object> item in temp)
{
((IDictionary<string, object>)obj).Add(item.Key, item.Value);
}
Console.WriteLine(string.Format("Name:{0}", obj.GetType().GetProperty("name").GetValue(obj, null).ToString()));
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment