/// <summary> /// Creates a new <see cref="RuntimePropertyProxy"/> instance for the given <see cref="PropertyInfo"/> /// </summary> /// <param name="propertyInfo">The property info</param> /// <returns></returns> /// <exception cref="ArgumentNullException">Throws argument null exception when <c>propertyInfo</c> is null</exception> public static RuntimePropertyProxy Create(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } RuntimeMethodProxy getMethod = null; if (propertyInfo.CanRead) { getMethod = RuntimeMethodProxy.Create(propertyInfo.GetMethod); } RuntimeMethodProxy setMethod = null; if (propertyInfo.CanWrite) { setMethod = RuntimeMethodProxy.Create(propertyInfo.SetMethod); } return(new RuntimePropertyProxy(propertyInfo, getMethod, setMethod)); }
/// <summary> /// Initialize a new instance of this class with the provided arguments /// </summary> /// <param name="propertyInfo">The property info</param> /// <param name="getMethod">The get method proxy</param> /// <param name="setMethod">The set method proxy</param> private RuntimePropertyProxy(PropertyInfo propertyInfo, RuntimeMethodProxy getMethod, RuntimeMethodProxy setMethod) { Property = propertyInfo; GetMethod = getMethod; SetMethod = setMethod; }