public PropertyGetter(PropertyInfo propertyInfo) { _propertyInfo = propertyInfo; _name = _propertyInfo.Name; _memberType = _propertyInfo.PropertyType; if (_propertyInfo.GetGetMethod(true) != null) _lateBoundPropertyGet = DelegateFactory.CreateGet(propertyInfo); }
public PropertyGetter(PropertyInfo propertyInfo) { _propertyInfo = propertyInfo; _name = _propertyInfo.Name; _memberType = _propertyInfo.PropertyType; if (_propertyInfo.GetGetMethod(true) != null) { _lateBoundPropertyGet = DelegateFactory.CreateGet(propertyInfo); } }
public void PropertyTests() { PropertyInfo property = typeof(Source).GetProperty("Value", typeof(int)); LateBoundPropertyGet callback = DelegateFactory.CreateGet(property); var source = new Source { Value = 5 }; int result = (int)callback(source); result.ShouldEqual(5); }