当前位置: 首页>>代码示例>>C#>>正文


C# MethodBase.GetParameters方法代码示例

本文整理汇总了C#中MethodBase.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# MethodBase.GetParameters方法的具体用法?C# MethodBase.GetParameters怎么用?C# MethodBase.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MethodBase的用法示例。


在下文中一共展示了MethodBase.GetParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetParameterTypes

 // returns array of the types of the parameters of the method specified by methodinfo
 public static Type[] GetParameterTypes( MethodBase methodbase )
 {
     ParameterInfo[] parameterinfos = methodbase.GetParameters();
     Type[] paramtypes = new Type[ parameterinfos.GetUpperBound(0) + 1 ];
     for( int i = 0; i < parameterinfos.GetUpperBound(0) + 1; i ++ )
     {
         paramtypes[i] = parameterinfos[i].ParameterType;
     }
     return paramtypes;
 }
开发者ID:achoum,项目名称:spring,代码行数:11,代码来源:AbicWrapperGenerator.cs

示例2: GetFullNameForStackTrace

		public static void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi)
		{
			var declaringType = mi.DeclaringType;
			if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
				declaringType = declaringType.GetGenericTypeDefinition ();

			// Get generic definition
			var bindingflags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			foreach (var m in declaringType.GetMethods (bindingflags)) {
				if (m.MetadataToken == mi.MetadataToken) {
					mi = m;
					break;
				}
			}

			sb.Append (declaringType.ToString ());

			sb.Append (".");
			sb.Append (mi.Name);

			if (mi.IsGenericMethod) {
				Type[] gen_params = mi.GetGenericArguments ();
				sb.Append ("[");
				for (int j = 0; j < gen_params.Length; j++) {
					if (j > 0)
						sb.Append (",");
					sb.Append (gen_params [j].Name);
				}
				sb.Append ("]");
			}

			ParameterInfo[] p = mi.GetParameters ();

			sb.Append (" (");
			for (int i = 0; i < p.Length; ++i) {
				if (i > 0)
					sb.Append (", ");

				Type pt = p[i].ParameterType;
				if (pt.IsGenericType && ! pt.IsGenericTypeDefinition)
					pt = pt.GetGenericTypeDefinition ();

				sb.Append (pt.ToString());

				if (p [i].Name != null) {
					sb.Append (" ");
					sb.Append (p [i].Name);
				}
			}
			sb.Append (")");
		}
开发者ID:BogdanovKirill,项目名称:mono,代码行数:51,代码来源:StackTraceHelper.cs

示例3: CompareParmsCount

    static bool CompareParmsCount(MethodBase l, MethodBase r)
    {
        if (l == r)
        {
            return false;
        }

        int c1 = l.IsStatic ? 0 : 1;
        int c2 = r.IsStatic ? 0 : 1;

        c1 += l.GetParameters().Length;
        c2 += r.GetParameters().Length;

        return c1 == c2;
    }
开发者ID:xlwangcs,项目名称:LuaFramework_UGUI,代码行数:15,代码来源:ToLuaExport.cs

示例4: CreateMethod

		public MethodSpec CreateMethod (MethodBase mb, TypeSpec declaringType)
		{
			Modifiers mod = ReadMethodModifiers (mb, declaringType);
			TypeParameterSpec[] tparams;

			var parameters = CreateParameters (declaringType, mb.GetParameters (), mb);

			if (mb.IsGenericMethod) {
				if (!mb.IsGenericMethodDefinition)
					throw new NotSupportedException ("assert");

				tparams = CreateGenericParameters (0, mb.GetGenericArguments ());
			} else {
				tparams = null;
			}

			MemberKind kind;
			TypeSpec returnType;
			if (mb.MemberType == MemberTypes.Constructor) {
				kind = MemberKind.Constructor;
				returnType = module.Compiler.BuiltinTypes.Void;
			} else {
				//
				// Detect operators and destructors
				//
				string name = mb.Name;
				kind = MemberKind.Method;
				if (tparams == null && !mb.DeclaringType.IsInterface && name.Length > 6) {
					if ((mod & (Modifiers.STATIC | Modifiers.PUBLIC)) == (Modifiers.STATIC | Modifiers.PUBLIC)) {
						if (name[2] == '_' && name[1] == 'p' && name[0] == 'o') {
							var op_type = Operator.GetType (name);
							if (op_type.HasValue && parameters.Count > 0 && parameters.Count < 3) {
								kind = MemberKind.Operator;
							}
						}
					} else if (parameters.IsEmpty && name == Destructor.MetadataName) {
						kind = MemberKind.Destructor;
						if (declaringType.BuiltinType == BuiltinTypeSpec.Type.Object) {
							mod &= ~Modifiers.OVERRIDE;
							mod |= Modifiers.VIRTUAL;
						}
					}
				}

				var mi = (MethodInfo) mb;
				returnType = ImportType (mi.ReturnType, new DynamicTypeReader (mi.ReturnParameter));

				// Cannot set to OVERRIDE without full hierarchy checks
				// this flag indicates that the method could be override
				// but further validation is needed
				if ((mod & Modifiers.OVERRIDE) != 0) {
					bool is_real_override = false;
					if (kind == MemberKind.Method && declaringType.BaseType != null) {
						var btype = declaringType.BaseType;
						if (IsOverrideMethodBaseTypeAccessible (btype)) {
							var filter = MemberFilter.Method (name, tparams != null ? tparams.Length : 0, parameters, null);
							var candidate = MemberCache.FindMember (btype, filter, BindingRestriction.None);

							//
							// For imported class method do additional validation to be sure that metadata
							// override flag was correct
							// 
							// Difference between protected internal and protected is ok
							//
							const Modifiers conflict_mask = Modifiers.AccessibilityMask & ~Modifiers.INTERNAL;
							if (candidate != null && (candidate.Modifiers & conflict_mask) == (mod & conflict_mask) && !candidate.IsStatic) {
								is_real_override = true;
							}
						}
					}

					if (!is_real_override) {
						mod &= ~Modifiers.OVERRIDE;
						if ((mod & Modifiers.SEALED) != 0)
							mod &= ~Modifiers.SEALED;
						else
							mod |= Modifiers.VIRTUAL;
					}
				}
			}

			IMemberDefinition definition;
			if (tparams != null) {
				var gmd = new ImportedGenericMethodDefinition ((MethodInfo) mb, returnType, parameters, tparams, this);
				foreach (var tp in gmd.TypeParameters) {
					ImportTypeParameterTypeConstraints (tp, tp.GetMetaInfo ());
				}

				definition = gmd;
			} else {
				definition = new ImportedParameterMemberDefinition (mb, returnType, parameters, this);
			}

			MethodSpec ms = new MethodSpec (kind, declaringType, definition, returnType, mb, parameters, mod);
			if (tparams != null)
				ms.IsGeneric = true;

			return ms;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:99,代码来源:import.cs

示例5: GetMethodParameters

        static string GetMethodParameters (MethodBase method)
        {
                StringBuilder sb;
                ParameterInfo [] pi = method.GetParameters ();

                if (pi.Length == 0)
                        return "()";

                else {
                        sb = new StringBuilder ();
                        sb.Append ('(');

                        int i = 0;
                        string modifier;
                        foreach (ParameterInfo parameter in pi) {
                                bool isPointer = false;
                                if (parameter.ParameterType.IsByRef) {
                                        sb.Append (GetParameterModifier (parameter));
                                        isPointer = true;
                                }
                                string param = ConvertCTSName (parameter.ParameterType.FullName, isPointer);

                                sb.Append (param);
                                sb.Append (" " + parameter.Name);
                                if (i + 1 < pi.Length) sb.Append (", ");
                                i++;
                        }
                        sb.Append (')');
                }

                return sb.ToString ();
        }
开发者ID:emtees,项目名称:old-code,代码行数:32,代码来源:updater.cs

示例6: ProcessParams

    static int ProcessParams(MethodBase md, int tab, bool beConstruct, bool beLuaString, bool beCheckTypes = false)
    {
        ParameterInfo[] paramInfos = md.GetParameters();
        int count = paramInfos.Length;
        string head = string.Empty;

        for (int i = 0; i < tab; i++)
        {
            head += "\t";
        }

        if (!md.IsStatic && !beConstruct)
        {
            if (md.Name == "Equals")
            {
                if (!type.IsValueType)
                {
                    sb.AppendFormat("{0}{1} obj = LuaScriptMgr.GetVarObject(L, 1) as {1};\r\n", head, className);
                }
                else
                {
                    sb.AppendFormat("{0}{1} obj = ({1})LuaScriptMgr.GetVarObject(L, 1);\r\n", head, className);
                }
            }
            else if (className != "Type" && className != "System.Type")
            {
                if (typeof(UnityEngine.Object).IsAssignableFrom(type))
                {
                    sb.AppendFormat("{0}{1} obj = ({1})LuaScriptMgr.GetUnityObjectSelf(L, 1, \"{1}\");\r\n", head, className);
                }
                else if(typeof(UnityEngine.TrackedReference).IsAssignableFrom(type))
                {
                    sb.AppendFormat("{0}{1} obj = ({1})LuaScriptMgr.GetTrackedObjectSelf(L, 1, \"{1}\");\r\n", head, className);
                }
                else
                {
                    sb.AppendFormat("{0}{1} obj = ({1})LuaScriptMgr.GetNetObjectSelf(L, 1, \"{1}\");\r\n", head, className);
                }
            }
            else
            {
                sb.AppendFormat("{0}{1} obj = LuaScriptMgr.GetTypeObject(L, 1);\r\n", head, className);
            }
        }

        for (int j = 0; j < count; j++)
        {
            ParameterInfo param = paramInfos[j];
            string str = GetTypeStr(param.ParameterType);

            string arg = "arg" + j;
            int offset = (md.IsStatic || beConstruct) ? 1 : 2;

            if (param.Attributes == ParameterAttributes.Out)
            {
                Type outType = GetRefBaseType(param.ParameterType.ToString());

                if (outType.IsValueType)
                {
                    sb.AppendFormat("{0}{1} {2};\r\n", head, str, arg);
                }
                else
                {
                    sb.AppendFormat("{0}{1} {2} = null;\r\n", head, str, arg);
                }
            }
            else if (param.ParameterType == typeof(bool))
            {
                if (beCheckTypes)
                {
                    sb.AppendFormat("{2}bool {0} = LuaDLL.lua_toboolean(L, {1});\r\n", arg, j + offset, head);
                }
                else
                {
                    sb.AppendFormat("{2}bool {0} = LuaScriptMgr.GetBoolean(L, {1});\r\n", arg, j + offset, head);
                }
            }
            else if (param.ParameterType == typeof(string))
            {
                string getStr = beLuaString ? "GetString" : "GetLuaString";
                sb.AppendFormat("{2}string {0} = LuaScriptMgr.{3}(L, {1});\r\n", arg, j + offset, head, getStr);
            }
            else if (param.ParameterType.IsPrimitive)
            {
                if (beCheckTypes)
                {
                    sb.AppendFormat("{3}{0} {1} = ({0})LuaDLL.lua_tonumber(L, {2});\r\n", str, arg, j + offset, head);
                }
                else
                {
                    sb.AppendFormat("{3}{0} {1} = ({0})LuaScriptMgr.GetNumber(L, {2});\r\n", str, arg, j + offset, head);
                }
            }
            else if (param.ParameterType == typeof(LuaFunction))
            {
                if (beCheckTypes)
                {
                    sb.AppendFormat("{2}LuaFunction {0} = LuaScriptMgr.ToLuaFunction(L, {1});\r\n", arg, j + offset, head);
                }
                else
//.........这里部分代码省略.........
开发者ID:amadabarney,项目名称:Bead,代码行数:101,代码来源:ToLuaExport.cs

示例7: methodSignaturesMatch

    private static bool methodSignaturesMatch( MethodBase lhs, MethodBase rhs )
    {
        if( lhs.Name != rhs.Name )
            return false;

        var lhsParams = lhs.GetParameters();
        var rhsParams = rhs.GetParameters();

        if( lhsParams.Length != rhsParams.Length )
            return false;

        for( int i = 0; i < lhsParams.Length; i++ )
        {
            if( lhsParams[ i ].ParameterType != rhsParams[ i ].ParameterType )
                return false;
        }

        return true;
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:19,代码来源:MetroReflectionExtensions.cs

示例8: GetArgumentsSignature

 string GetArgumentsSignature(MethodBase m)
 {
     return string.Join (", ", m.GetParameters ().Select (p => GetArgumentAttributes (p) + GetImplementedType (p.ParameterType) + " " + EscapeIdentifier (p.Name) + GetArgumentOptionalInitializer (p)).ToArray ());
 }
开发者ID:atsushieno,项目名称:md-typescript,代码行数:4,代码来源:TS2CSImplementor.cs

示例9: CreateMethodWrapper

		private MethodWrapper CreateMethodWrapper(string name, string sig, TypeWrapper[] argTypeWrappers, TypeWrapper retTypeWrapper, MethodBase mb, bool privateInterfaceImplHack)
		{
			ExModifiers exmods = AttributeHelper.GetModifiers(mb, true);
			Modifiers mods = exmods.Modifiers;
			if (name == "Finalize" && sig == "()V" && !mb.IsStatic &&
				IsRemappedImplDerived(TypeAsBaseType))
			{
				// TODO if the .NET also has a "finalize" method, we need to hide that one (or rename it, or whatever)
				MethodWrapper mw = new SimpleCallMethodWrapper(this, "finalize", "()V", (MethodInfo)mb, PrimitiveTypeWrapper.VOID, TypeWrapper.EmptyArray, mods, MemberFlags.None, SimpleOpCode.Call, SimpleOpCode.Callvirt);
				mw.SetDeclaredExceptions(new string[] { "java.lang.Throwable" });
				return mw;
			}
			ParameterInfo[] parameters = mb.GetParameters();
			Type[] args = new Type[parameters.Length];
			bool hasByRefArgs = false;
			bool[] byrefs = null;
			for (int i = 0; i < parameters.Length; i++)
			{
				args[i] = parameters[i].ParameterType;
				if (parameters[i].ParameterType.IsByRef)
				{
					if (byrefs == null)
					{
						byrefs = new bool[args.Length];
					}
					byrefs[i] = true;
					hasByRefArgs = true;
				}
			}
			if (privateInterfaceImplHack)
			{
				mods &= ~Modifiers.Abstract;
				mods |= Modifiers.Final;
			}
			if (hasByRefArgs)
			{
				if (!(mb is ConstructorInfo) && !mb.IsStatic)
				{
					mods |= Modifiers.Final;
				}
				return new ByRefMethodWrapper(args, byrefs, this, name, sig, mb, retTypeWrapper, argTypeWrappers, mods, false);
			}
			else
			{
				return new TypicalMethodWrapper(this, name, sig, mb, retTypeWrapper, argTypeWrappers, mods, MemberFlags.None);
			}
		}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:47,代码来源:DotNetTypeWrapper.cs

示例10: GetMethodType

    static int GetMethodType(MethodBase md, out PropertyInfo pi)
    {
        int methodType = 0;
        pi = null;
        int pos = allProps.FindIndex((p) => { return p.GetGetMethod() == md || p.GetSetMethod() == md; });

        if (pos >= 0)
        {
            methodType = 1;
            pi = allProps[pos];

            if (md == pi.GetGetMethod())
            {
                if (md.GetParameters().Length > 0)
                {
                    methodType = 2;
                }
            }
            else if (md == pi.GetSetMethod())
            {
                if (md.GetParameters().Length > 1)
                {
                    methodType = 2;
                }
            }
        }

        return methodType;
    }
开发者ID:xlwangcs,项目名称:LuaFramework_UGUI,代码行数:29,代码来源:ToLuaExport.cs

示例11: Compare

    static int Compare(MethodBase lhs, MethodBase rhs)
    {
        int off1 = lhs.IsStatic ? 0 : 1;
        int off2 = rhs.IsStatic ? 0 : 1;

        ParameterInfo[] lp = lhs.GetParameters();
        ParameterInfo[] rp = rhs.GetParameters();

        int pos1 = GetOptionalParamPos(lp);
        int pos2 = GetOptionalParamPos(rp);

        if (pos1 >= 0 && pos2 < 0)
        {
            return 1;
        }
        else if (pos1 < 0 && pos2 >= 0)
        {
            return -1;
        }
        else if(pos1 >= 0 && pos2 >= 0)
        {
            pos1 += off1;
            pos2 += off2;

            if (pos1 != pos2)
            {
                return pos1 > pos2 ? -1 : 1;
            }
            else
            {
                pos1 -= off1;
                pos2 -= off2;

                if (lp[pos1].ParameterType.GetElementType() == typeof(object) && rp[pos2].ParameterType.GetElementType() != typeof(object))
                {
                    return 1;
                }
                else if (lp[pos1].ParameterType.GetElementType() != typeof(object) && rp[pos2].ParameterType.GetElementType() == typeof(object))
                {
                    return -1;
                }
            }
        }

        int c1 = off1 + lp.Length;
        int c2 = off2 + rp.Length;

        if (c1 > c2)
        {
            return 1;
        }
        else if (c1 == c2)
        {
            List<ParameterInfo> list1 = new List<ParameterInfo>(lp);
            List<ParameterInfo> list2 = new List<ParameterInfo>(rp);

            if (list1.Count > list2.Count)
            {
                if (list1[0].ParameterType == typeof(object))
                {
                    return 1;
                }

                list1.RemoveAt(0);
            }
            else if (list2.Count > list1.Count)
            {
                if (list2[0].ParameterType == typeof(object))
                {
                    return -1;
                }

                list2.RemoveAt(0);
            }

            for (int i = 0; i < list1.Count; i++)
            {
                if (list1[i].ParameterType == typeof(object) && list2[i].ParameterType != typeof(object))
                {
                    return 1;
                }
                else if (list1[i].ParameterType != typeof(object) && list2[i].ParameterType == typeof(object))
                {
                    return -1;
                }
            }

            return 0;
        }
        else
        {
            return -1;
        }
    }
开发者ID:xlwangcs,项目名称:LuaFramework_UGUI,代码行数:94,代码来源:ToLuaExport.cs

示例12: CompareMethodSigAndName

        private static bool CompareMethodSigAndName(MethodBase m1, MethodBase m2)
        {
            ParameterInfo[] params1 = m1.GetParameters();
            ParameterInfo[] params2 = m2.GetParameters();

            if (params1.Length != params2.Length)
                return false;

            int numParams = params1.Length;
            for (int i = 0; i < numParams; i++)
            {
                if (params1[i].ParameterType != params2[i].ParameterType)
                    return false;
            }

            return true;
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:17,代码来源:DefaultBinder.cs

示例13: ProcessParams

    static int ProcessParams(MethodBase md, int tab, bool beConstruct, bool beOverride = false, bool beCheckTypes = false)
    {
        ParameterInfo[] paramInfos = md.GetParameters();
        int count = paramInfos.Length;
        string head = string.Empty;
        int offset = (md.IsStatic || beConstruct) ? 1 : 2;        

        if (md.Name == "op_Equality")
        {
            beCheckTypes = true;
        }

        for (int i = 0; i < tab; i++)
        {
            head += "\t";
        }
        

        if (!md.IsStatic && !beConstruct)
        {
            if (md.Name == "Equals")
            {
                if (!type.IsValueType && !beCheckTypes)
                {
                    CheckObject(head, type, className, 1);
                }
                else
                {                                      
                    sb.AppendFormat("{0}{1} obj = ({1})ToLua.ToObject(L, 1);\r\n", head, className);                    
                }
            }
            else if (!beCheckTypes)
            {
                CheckObject(head, type, className, 1);                
            }
            else
            {
                ToObject(head, type, className, 1);
            }
        }

        for (int j = 0; j < count; j++)
        {
            ParameterInfo param = paramInfos[j];                 
            string arg = "arg" + j;                
            bool beOutArg = param.Attributes == ParameterAttributes.Out;
            bool beParams = IsParams(param);
            ProcessArg(param.ParameterType, head, arg, offset + j, beCheckTypes, beParams ,beOutArg);
        }

        StringBuilder sbArgs = new StringBuilder();
        List<string> refList = new List<string>();
        List<Type> refTypes = new List<Type>();

        for (int j = 0; j < count; j++)
        {
            ParameterInfo param = paramInfos[j];

            if (!param.ParameterType.ToString().Contains("&"))
            {
                sbArgs.Append("arg");
            }
            else
            {
                if (param.Attributes == ParameterAttributes.Out)
                {
                    sbArgs.Append("out arg");
                }
                else
                {
                    sbArgs.Append("ref arg");
                }

                refList.Add("arg" + j);
                refTypes.Add(GetRefBaseType(param.ParameterType.ToString()));
            }


            sbArgs.Append(j);

            if (j != count - 1)
            {
                sbArgs.Append(", ");
            }
        }

        if (beConstruct)
        {
            sb.AppendFormat("{2}{0} obj = new {0}({1});\r\n", className, sbArgs.ToString(), head);
            string str = GetPushFunction(type);
            sb.AppendFormat("{0}ToLua.{1}(L, obj);\r\n", head, str);

            for (int i = 0; i < refList.Count; i++)
            {
                GenPushStr(refTypes[i], refList[i], head);
            } 
            
            return refList.Count + 1;          
        }

//.........这里部分代码省略.........
开发者ID:zhenyao2008,项目名称:LuaFramework_UGUI,代码行数:101,代码来源:ToLuaExport.cs

示例14: FindMostSpecificMethod

        private static int FindMostSpecificMethod(MethodBase m1, int[] paramOrder1, Type paramArrayType1,
                                                  MethodBase m2, int[] paramOrder2, Type paramArrayType2,
                                                  Type[] types, Object[] args)
        {
            // Find the most specific method based on the parameters.
            int res = FindMostSpecific(m1.GetParameters(), paramOrder1, paramArrayType1,
                                       m2.GetParameters(), paramOrder2, paramArrayType2, types, args);

            // If the match was not ambigous then return the result.
            if (res != 0)
                return res;

            // Check to see if the methods have the exact same name and signature.
            if (CompareMethodSigAndName(m1, m2))
            {
                // Determine the depth of the declaring types for both methods.
                int hierarchyDepth1 = GetHierarchyDepth(m1.DeclaringType);
                int hierarchyDepth2 = GetHierarchyDepth(m2.DeclaringType);

                // The most derived method is the most specific one.
                if (hierarchyDepth1 == hierarchyDepth2)
                {
                    return 0;
                }
                else if (hierarchyDepth1 < hierarchyDepth2)
                {
                    return 2;
                }
                else
                {
                    return 1;
                }
            }

            // The match is ambigous.
            return 0;
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:37,代码来源:DefaultBinder.cs

示例15: PrintMethodHead

    string PrintMethodHead(MethodBase mb)
    {
        var s = new StringBuilder();

        if (typeof(MethodInfo).IsInstanceOfType(mb))
        {
            s.Append(PrintTypeWithAssem(((MethodInfo)mb).ReturnType) + " ");
        }
        s.Append(mb.Name);
        if (mb.IsGenericMethodDefinition)
        {

            Type[] ts = mb.GetGenericArguments(); // we must have at least one generic argument
            s.Append(" <");
            for (int i = 0; i < ts.Length; i++)
            {
                s.Append("("); // we should always have some generic constrains
                Type[] cts = ts[i].GetGenericParameterConstraints();
                Array.Sort(cts, sc);
                for (int j = 0; j < cts.Length; j++)
                {
                    s.Append(PrintTypeWithAssem(cts[j]));
                    if (j < cts.Length - 1)
                        s.Append(", ");
                }
                s.Append(") ");
                s.Append(ts[i]);
                if (i < (ts.Length - 1))
                    s.Append(", ");
            }
            s.Append(">");
        }
        else if (mb.IsGenericMethod)
        {
            s.Append(" <");
            Type[] param = mb.GetGenericArguments();
            for (int i = 0; i < param.Length; i++)
            {
                s.Append(PrintTypeWithAssem(param[i]));
                if (i < (param.Length - 1))
                    s.Append(", ");
            }
            s.Append("> ");
        }
        s.Append(" (");
        int count = 0;
        foreach (ParameterInfo pa in mb.GetParameters())
        {
            // if the parameter is a generic parameter
            // we excerise some more info that we can get
            if (pa.ParameterType.IsGenericParameter)
            {
                if (pa.ParameterType.DeclaringMethod != null)
                    s.Append("!!" + pa.ParameterType.GenericParameterPosition + " " + pa.ParameterType);
                else s.Append("!" + pa.ParameterType.GenericParameterPosition + " " + pa.ParameterType);

            }
            else
            {
                s.Append(PrintTypeWithAssem(pa.ParameterType));
            }
            if ((++count) < mb.GetParameters().Length)
                s.Append(", ");
            else s.Append(")");
        }
        if (count == 0) s.Append(")");
        return s.ToString();
    }
开发者ID:dbremner,项目名称:clrinterop,代码行数:68,代码来源:AssemPrinter.cs


注:本文中的MethodBase.GetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。