Lines Matching refs:method

43     /// delegate from the MethodInfo, and then calling that within an anonymous method.
78 /// Creates a delegate which will cast the argument to the type that declares the method,
79 /// call the method on it, then convert the result to object.
81 /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
83 internal static Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method) =>
84 GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageObject(method);
87 /// Creates a delegate which will cast the argument to the type that declares the method,
88 /// call the method on it, then convert the result to the specified type. The method is expected
92 /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
94 internal static Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method) =>
95 GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageInt32(method);
98 /// Creates a delegate which will execute the given method after casting the first argument to
99 /// the type that declares the method, and the second argument to the first parameter type of the method.
101 /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
103 internal static Action<IMessage, object> CreateActionIMessageObject(MethodInfo method) =>
104 GetReflectionHelper(method.DeclaringType, method.GetParameters()[0].ParameterType).CreateActionIMessageObject(method);
107 /// Creates a delegate which will execute the given method after casting the first argument to
108 /// type that declares the method.
110 /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
112 internal static Action<IMessage> CreateActionIMessage(MethodInfo method) =>
113 GetReflectionHelper(method.DeclaringType, typeof(object)).CreateActionIMessage(method);
115 internal static Func<IMessage, bool> CreateFuncIMessageBool(MethodInfo method) =>
116 GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageBool(method);
122 /// Creates a delegate which will execute the given method after casting the first argument to
123 /// the type that declares the method, and the second argument to the first parameter type of the method.
141 Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method);
142 Action<IMessage> CreateActionIMessage(MethodInfo method);
143 Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method);
144 Action<IMessage, object> CreateActionIMessageObject(MethodInfo method);
145 Func<IMessage, bool> CreateFuncIMessageBool(MethodInfo method);
164 public Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method)
166 // On pleasant runtimes, we can create a Func<int> from a method returning
170 var del = (Func<T1, int>) method.CreateDelegate(typeof(Func<T1, int>));
178 var del = (Func<T1, T2>) method.CreateDelegate(typeof(Func<T1, T2>));
183 public Action<IMessage> CreateActionIMessage(MethodInfo method)
185 var del = (Action<T1>) method.CreateDelegate(typeof(Action<T1>));
189 public Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method)
191 var del = (Func<T1, T2>) method.CreateDelegate(typeof(Func<T1, T2>));
195 public Action<IMessage, object> CreateActionIMessageObject(MethodInfo method)
197 var del = (Action<T1, T2>) method.CreateDelegate(typeof(Action<T1, T2>));
201 public Func<IMessage, bool> CreateFuncIMessageBool(MethodInfo method)
203 var del = (Func<T1, bool>)method.CreateDelegate(typeof(Func<T1, bool>));
344 MethodInfo method = typeof(ReflectionUtil).GetMethod(nameof(SampleEnumMethod));
346 method.CreateDelegate(typeof(Func<int>));