dynamic ExpandoObject lamda

 var lst = new List<dynamic>();
            dynamic employee = new ExpandoObject();
            employee.Name = "John Smith";
            employee.Age = 33;
            lst.Add(employee);

            dynamic manager = new ExpandoObject();
            manager.Name = "Allison Brown";
            manager.Age = 42;
            lst.Add(manager);

            //dynamic kk = new ExpandoObject()
            //                 {
            //                     Name = "kting",
            //                     Age = 30
            //                 };
 
            foreach (var item in lst.Where(item => item.Age == 42))
            {
                Response.Write(item.Name);
            }

你可能感兴趣的:(dynamic)