ReflectionExtensions.GetMethod C# (CSharp) Method

GetMethod() public static method

public static GetMethod ( this type, string methodName ) : MethodInfo
type this
methodName string
return MethodInfo
    public static MethodInfo GetMethod(this Type type, string methodName)
    {
        return GetMethod(type, methodName, (BindingFlags)0x0);
    }

Same methods

ReflectionExtensions::GetMethod ( this type, string methodName, BindingFlags, flags ) : MethodInfo
ReflectionExtensions::GetMethod ( this type, string methodName, BindingFlags, bindingAttr, Object binder, Type parameters, Object modifiers ) : MethodInfo
ReflectionExtensions::GetMethod ( this type, string methodName, Type parameters ) : MethodInfo

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Create a factory generator.
        /// </summary>
        /// <param name="productRegistration">The component that will be activated in
        /// order to create the products of the factory.</param>
        /// <param name="delegateType">The delegate to provide as a factory.</param>
        /// <param name="parameterMapping">The parameter mapping mode to use.</param>
        public FactoryGenerator(Type delegateType, IComponentRegistration productRegistration, ParameterMapping parameterMapping)
        {
            if (productRegistration == null)
            {
                throw new ArgumentNullException("productRegistration");
            }
            Enforce.ArgumentTypeIsFunction(delegateType);

            _generator = CreateGenerator((activatorContextParam, resolveParameterArray) =>
            {
                // productRegistration, [new Parameter(name, (object)dps)]*
                var resolveParams = new Expression[] {
                    Expression.Constant(productRegistration, typeof(IComponentRegistration)),
                    Expression.NewArrayInit(typeof(Parameter), resolveParameterArray)
                };

                // c.Resolve(...)
                return(Expression.Call(
                           activatorContextParam,
                           ReflectionExtensions.GetMethod <IComponentContext>(cc => cc.ResolveComponent(default(IComponentRegistration), default(Parameter[]))),
                           resolveParams));
            },
                                         delegateType,
                                         GetParameterMapping(delegateType, parameterMapping));
        }
All Usage Examples Of ReflectionExtensions::GetMethod