Ejemplo n.º 1
0
 protected static void AddMethodToHandlerPart(FieldDefinitionHandlerPart handlerPart, MethodInfo method, Type delegateType)
 {
     if (method.IsStatic)
     {
         Delegate staticMethod = Delegate.CreateDelegate(delegateType, method);
         handlerPart.GetInstanceMethod = stemInstance => staticMethod;
     }
     else
     {
         handlerPart.GetInstanceMethod = stemInstance => Delegate.CreateDelegate(delegateType, stemInstance, method);
     }
 }
Ejemplo n.º 2
0
        public MethodSetter(FieldDefinitionHandlerPart definitionSetter, Stem <TItem> stem)
        {
            Delegate deleg = definitionSetter.GetInstanceMethod.Invoke(stem);

            _setterAction = (Action <TItem, TNav>)deleg;
        }