/// <summary>Initializes a new instance of the <seealso cref="PropertyAccessInfo"/> class.</summary> /// <param name="info">The <seealso cref="PropertyInfo"/> from which to retrieve the property info.</param> public PropertyAccessInfo(PropertyInfo info) { PropertyInfo = info; // You have to be kidding me right now var propertyType = PropertyType = info.PropertyType; var objectType = info.DeclaringType; GenericFunc = typeof(Func <,>).MakeGenericType(objectType, propertyType); GenericAction = typeof(Action <,>).MakeGenericType(objectType, propertyType); ObjectStringMappableAttribute = info.GetCustomAttribute <ObjectStringMappableAttribute>(); // TODO: Remove these GetMethodDelegate = info.GetGetMethod().CreateDelegate(GenericFunc); SetMethodDelegate = info.GetSetMethod()?.CreateDelegate(GenericAction); }
/// <summary>Initializes a new instance of the <seealso cref="PropertyAccessInfo"/> class.</summary> /// <param name="info">The <seealso cref="PropertyInfo"/> from which to retrieve the property info.</param> public PropertyAccessInfo(PropertyInfo info) : base(info) { ObjectStringMappableAttribute = info.GetCustomAttribute <ObjectStringMappableAttribute>(); }