dynamic:动态类型简单用法,写法
class 动态创建数据 { //动态类型:本质感觉跟object的用法差不多,只是在执行的时候才知道数据类型 public dynamic Dynamic() { //定义一个动态类型,作为返回值 dynamic data = new ExpandoObject(); List<dynamic> list = new List<dynamic>(); dynamic model = new ExpandoObject(); model.ID = 1; model.Name = "张三"; list.Add(model); data.list1 = list; return data; } public object Object() { //定义一个动态类型,作为返回值 object data = new object(); List<object> list = new List<object>(); object model = new object(); model.ID = 1; model.Name = "张三"; list.Add(model); data.list1 = list; return data; } }