Dynamic type

Jan 4, 2011 at 2:54 AM

How to injectfrom dynamic type? Anyone have experience for it?

Jan 4, 2011 at 7:37 AM

yes,

        public class Ac
        {
            public string Aa { get; set; }
        }

        [Test]
        public void Aa()
        {
            var o = new { Aa = "aa" };
            dynamic d = o;
            var a = new Ac{ Aa = "bb" };
            a.InjectFrom((object)d);
            Assert.AreEqual(o.Aa, a.Aa);
        }