Пример #1
0
 public PropertyGetter(PropertyInfo propertyInfo)
 {
     _propertyInfo = propertyInfo;
     _name = _propertyInfo.Name;
     _memberType = _propertyInfo.PropertyType;
     if (_propertyInfo.GetGetMethod(true) != null)
         _lateBoundPropertyGet = DelegateFactory.CreateGet(propertyInfo);
 }
Пример #2
0
 public PropertyGetter(PropertyInfo propertyInfo)
 {
     _propertyInfo = propertyInfo;
     _name         = _propertyInfo.Name;
     _memberType   = _propertyInfo.PropertyType;
     if (_propertyInfo.GetGetMethod(true) != null)
     {
         _lateBoundPropertyGet = DelegateFactory.CreateGet(propertyInfo);
     }
 }
Пример #3
0
        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);
        }