public MethodGetter(MethodInfo methodInfo) { _methodInfo = methodInfo; Name = _methodInfo.Name; _memberType = _methodInfo.ReturnType; _lateBoundMethodExpression = new Lazy <Expression <LateBoundMethod <object, TValue> > >(() => DelegateFactory.CreateGet <TValue>(methodInfo)); _lateBoundMethod = new Lazy <LateBoundMethod <object, TValue> >(() => _lateBoundMethodExpression.Value.Compile()); }
public PropertyGetter(PropertyInfo propertyInfo) { _propertyInfo = propertyInfo; Name = _propertyInfo.Name; MemberType = _propertyInfo.PropertyType; _lateBoundPropertyGetExpression = _propertyInfo.GetGetMethod(true) != null ? new Lazy <Expression <LateBoundPropertyGet <TSource, TValue> > >(() => DelegateFactory.CreateGet <TSource, TValue>(propertyInfo)) : new Lazy <Expression <LateBoundPropertyGet <TSource, TValue> > >(() => src => default(TValue)); _lateBoundPropertyGet = new Lazy <LateBoundPropertyGet <TSource, TValue> >(() => _lateBoundPropertyGetExpression.Value.Compile()); }