Exemple #1
0
        public static MethodSignature FromMethodInfo(MethodInfo methodInfo)
        {
            var ms = new MethodSignature();

            ms.OwnerType        = SignatureType.FromType(methodInfo.ReflectedType);
            ms.MethodName       = methodInfo.Name;
            ms.ParameterTypes   = methodInfo.GetParameters().Select(SignatureType.FromParameterInfo).ToList();
            ms.GenericArguments = methodInfo.GetGenericArguments().Select(SignatureType.FromType).ToList();
            ms.AccessModifier   = methodInfo.GetAccessModifier();
            ms.ReturnType       = SignatureType.FromType(methodInfo.ReturnType);
            ms.MethodType       = methodInfo.IsStatic ? MethodType.Static : MethodType.Instance;
            return(ms);
        }
        public MethodSearch SetOwnerType(Type type)
        {
            if (type == null)
            {
                return(this);
            }

            Context.SearchFor = Context.SearchFor | MethodSearchFlags.OwnerType;
            Context.OwnerType = SignatureType.FromType(type);
            if (Context.OwnerType.IsStatic)
            {
                SetMethodType(MethodType.Static);
            }
            return(this);
        }
 public MethodSearch SetReturnType(Type type)
 {
     Context.SearchFor  = Context.SearchFor | MethodSearchFlags.ReturnType;
     Context.ReturnType = SignatureType.FromType(type);
     return(this);
 }