public static AccessorBuilder.SetFieldValueUnboundDelegate CreateSetter(Type instanceType, Type fieldType, string fieldName) { DynamicMethod method = AccessorBuilder.CreateSetterImpl(instanceType, fieldType, fieldName); return((AccessorBuilder.SetFieldValueUnboundDelegate)method.CreateDelegate(new Type[] { typeof(AccessorBuilder.SetFieldValueUnboundDelegate) })); }
public static AccessorBuilder.SetFieldValueBoundDelegate CreateSetter(object instance, Type fieldType, string fieldName) { if (instance == null) { throw new ArgumentNullException("instance"); } DynamicMethod dynamicMethod = AccessorBuilder.CreateSetterImpl(instance.GetType(), fieldType, fieldName); return((AccessorBuilder.SetFieldValueBoundDelegate)dynamicMethod.CreateDelegate(typeof(AccessorBuilder.SetFieldValueBoundDelegate), instance)); }