Example #1
0
 public Delegate FieldSet(FieldInfo field, Type delegateType)
 {
     return(BuildDelegate(DelegateMap.FieldSet(delegateType, field),
                          parameters =>
     {
         var instance = parameters.Length > 1 ? parameters[0] : null;
         var value = parameters.Length > 1 ? parameters[1] : parameters[0];
         var fieldExpr = Expression.Field(instance, field);
         return Expression.Assign(fieldExpr, value);
     }));
 }
 public Delegate FieldSet(FieldInfo field, Type delegateType)
 {
     return(BuildDelegate(DelegateMap.FieldSet(delegateType, field),
                          il => il.EmitFieldSet(field)));
 }