示例#1
0
        public void TestGetProperty1()
        {
            var type = typeof(MyClass);

            DynamicReflection.DynamicType dy = new DynamicReflection.DynamicType(type);
            var pro = dy.GetProperty("Id");
            var obj = new MyClass {
                Id = null
            };

            for (int i = 0; i < 10000000; i++)
            {
                var val = pro.GetValue(obj, null);
            }
        }
示例#2
0
        public void TestSetProperty1()
        {
            var type = typeof(MyClass);

            DynamicReflection.DynamicType dy = new DynamicReflection.DynamicType(type);
            var pro = dy.GetProperty("Id");
            var obj = new MyClass {
                Id = Guid.NewGuid()
            };
            var newVal = Guid.NewGuid();

            for (int i = 0; i < 2300000; i++)
            {
                pro.SetValue(obj, newVal, null);
            }
        }