Example #1
0
        public void TestConstruction1()
        {
            var type = typeof(MyClass);

            DynamicReflection.DynamicType dy = new DynamicReflection.DynamicType(type);
            var constructior = dy.GetConstructor(new Type[0]);

            for (int i = 0; i < 10000000; i++)
            {
                var t = constructior.Invoke(new object[] { });
            }
        }
Example #2
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);
            }
        }
Example #3
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);
            }
        }