src/Mimp.SeeSharper.Reflection/FieldInfoExtensions.cs
/// <summary>
/// Return a compiled delegate to assign the field.
/// </summary>
/// <typeparam name="TDelegate"></typeparam>
/// <param name="field"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException">If the delegate hasn't one parameter for the instance and one parameter for the value.</exception>
/// <exception cref="InvalidOperationException">If the delegate value type isn't castable to the field type.</exception>
Return a compiled delegate to assign the field.
Return a compiled delegate to assign the field .
public static TDelegate GetInstanceAssignDelegate<TDelegate>(this FieldInfo field) where TDelegate : Delegate
        {
            if (field is null)
                throw new ArgumentNullException(nameof(field));
            return (TDelegate)field.GetInstanceAssignDelegate(typeof(TDelegate));
        }
public static TDelegate GetInstanceAssignDelegate < TDelegate > ( this FieldInfo field ) where TDelegate : Delegate { if ( field is null ) throw new ArgumentNullException ( nameof ( field ) ) ; return ( TDelegate ) field . GetInstanceAssignDelegate ( typeof ( TDelegate ) ) ; }
Return a compiled delegate to assign the field.
Return a compiled delegate to assign the field .
None
None
If the delegate hasn't one parameter for the instance and one parameter for the value.
If the delegate hasn ' t one parameter for the instance and one parameter for the value .
If the delegate value type isn't castable to the field type.
If the delegate value type isn ' t castable to the field type .
FieldInfo
this
field
None
typeparam
None