public FieldReference(object target, FieldInfo field) { SRDebugUtil.AssertNotNull(target); _target = target; _field = field; }
public PropertyReference(object target, PropertyInfo property) { SRDebugUtil.AssertNotNull(target); _target = target; _property = property; }
public MethodReference(object target, MethodInfo method) { SRDebugUtil.AssertNotNull(target); _target = target; _method = method; }
/// <summary> /// Create a property reference from an object target and reflection PropertyInfo. /// This represents a property on an object. /// </summary> public PropertyReference(object target, PropertyInfo property) { SRDebugUtil.AssertNotNull(target); SRDebugUtil.AssertNotNull(property); PropertyType = property.PropertyType; _property = property; _target = target; #if NETFX_CORE if (_property.GetMethod != null && _property.GetMethod.IsPublic) #else if (property.GetGetMethod() != null) #endif { _getter = () => SRReflection.GetPropertyValue(target, property); } #if NETFX_CORE if (_property.SetMethod != null && _property.SetMethod.IsPublic) #else if (property.GetSetMethod() != null) #endif { _setter = (v) => SRReflection.SetPropertyValue(target, property, v); } }
/// <summary> /// Create a property reference from lambdas. This has no underlying reflection or object associated with it. /// </summary> public PropertyReference(Type type, Func <object> getter = null, Action <object> setter = null, Attribute[] attributes = null) { SRDebugUtil.AssertNotNull(type); PropertyType = type; _attributes = attributes; _getter = getter; _setter = setter; }
public CustomReference(Type type, string name, Func <object> get, Action <object> set) { SRDebugUtil.AssertNotNull(get); SRDebugUtil.AssertNotNull(set); _type = type; _name = name; _get = get; _set = set; }
public MethodReference(object target, MethodInfo method) { SRDebugUtil.AssertNotNull(target); _method = o => method.Invoke(target, o); }
protected void AssertNotNull(object value, string fieldName = null) { SRDebugUtil.AssertNotNull(value, fieldName, this); }