C#给ExpandoObject动态添加对象

C#给ExpandoObject动态添加属性

C#给ExpandoObject动态添加对象:

方法一:

dynamic x = new ExpandoObject();
x.NewProp = string.Empty;

 

方法二:

var x = new ExpandoObject() as IDictionary<string, Object>;
x.Add("NewProp", string.Empty);
 
posted @ 2021-09-22 18:54  科睿思博  阅读(318)  评论(0编辑  收藏  举报