Reflection Performance - Create Delegate (Properties C#)
问题 I'm having performance problems with using reflection. So I decided to create delegates for the properties of my objects and so far got this: TestClass cwp = new TestClass(); var propertyInt = typeof(TestClass).GetProperties().Single(obj => obj.Name == "AnyValue"); var access = BuildGetAccessor(propertyInt.GetGetMethod()); var result = access(cwp); static Func<object, object> BuildGetAccessor(MethodInfo method) { var obj = Expression.Parameter(typeof(object), "o"); Expression<Func<object,