System.Reflection.RuntimeMethodInfo.ConstructParameters C# (CSharp) Method

ConstructParameters() static private method

static private ConstructParameters ( Type parameters, CallingConventions callingConvention ) : string
parameters System.Type
callingConvention CallingConventions
return string
        internal static string ConstructParameters(Type[] parameters, CallingConventions callingConvention)
        {
            string toString = "";
            string comma = "";

            for(int i = 0; i < parameters.Length; i++)
            {
                Type t = parameters[i];

                toString += comma;
                toString += t.SigToString();
                if (t.IsByRef)
                {
                    toString = toString.TrimEnd(new char[] { '&' });
                    toString += " ByRef";
                }

                comma = ", ";
            }

            if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
            {
                toString += comma;
                toString += "...";
            }

            return toString;
        }

Same methods

RuntimeMethodInfo::ConstructParameters ( ParameterInfo parameters, CallingConventions callingConvention ) : string

Usage Example

Esempio n. 1
0
        public override string ToString()
        {
            string str = this.PropertyType.SigToString() + " " + this.Name;

            RuntimeTypeHandle[] arguments = this.Signature.Arguments;
            if (arguments.Length <= 0)
            {
                return(str);
            }
            Type[] parameters = new Type[arguments.Length];
            for (int i = 0; i < parameters.Length; i++)
            {
                parameters[i] = arguments[i].GetRuntimeType();
            }
            return(str + " [" + RuntimeMethodInfo.ConstructParameters(parameters, this.Signature.CallingConvention) + "]");
        }