Fix: Instance type is required
This commit is contained in:
parent
ded647aad4
commit
191d65f8d9
|
@ -51,8 +51,10 @@ namespace StardewModdingAPI.Framework.Reflection
|
||||||
this.Parent = obj;
|
this.Parent = obj;
|
||||||
this.PropertyInfo = property ?? throw new ArgumentNullException(nameof(property));
|
this.PropertyInfo = property ?? throw new ArgumentNullException(nameof(property));
|
||||||
|
|
||||||
this.GetterDelegate = (Func<object, TValue>)Delegate.CreateDelegate(typeof(Func<object, TValue>), this.PropertyInfo.GetMethod);
|
Type[] types = new Type[] { this.PropertyInfo.DeclaringType, typeof(TValue)};
|
||||||
this.SetterDelegate = (Action<object, TValue>)Delegate.CreateDelegate(typeof(Action<object, TValue>), this.PropertyInfo.SetMethod);
|
|
||||||
|
this.GetterDelegate = (Func<object, TValue>)Delegate.CreateDelegate(typeof(Func<,>).MakeGenericType(types), this.PropertyInfo.GetMethod);
|
||||||
|
this.SetterDelegate = (Action<object, TValue>)Delegate.CreateDelegate(typeof(Action<,>).MakeGenericType(types), this.PropertyInfo.SetMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Get the property value.</summary>
|
/// <summary>Get the property value.</summary>
|
||||||
|
|
Loading…
Reference in New Issue