C# dynamic

 

 

        [TestMethod]
        public void DynamicTest()
        {
            dynamic Customer = new ExpandoObject();
            Customer.Name = "Lucy";
            Customer.Age = 20;
            Customer.Female = true;

            var obj = new { name="zy", age="20" };

            var t =obj.GetType().ToString();
            var t2 = Customer.GetType().ToString();

            Assert.AreEqual(Customer.Name, "Lucy"); 
            
        }

 

 

  On your solution explorer window, right click to References, select Add Reference, go to .NET tab, find and add Microsoft.CSharp.

 

posted @ 2014-01-27 20:36  zyip  阅读(204)  评论(0编辑  收藏  举报