示例#1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            Type retType = PropertyType;

            if (Type.ShouldPrintFullName(retType))
            {
                sb.Append(retType.ToString());
            }
            else
            {
                sb.Append(retType.Name);
            }

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

            var pi = GetIndexParameters();

            if (pi.Length > 0)
            {
                sb.Append(" [");
                ParameterInfo.FormatParameters(sb, pi);
                sb.Append("]");
            }

            return(sb.ToString());
        }
示例#2
0
        internal virtual string FormatNameAndSig(bool serialization)
        {
            // Serialization uses ToString to resolve MethodInfo overloads.
            StringBuilder sbName = new StringBuilder(Name);

            sbName.Append("(");
            ParameterInfo.FormatParameters(sbName, GetParametersNoCopy(), CallingConvention, serialization);
            sbName.Append(")");

            return(sbName.ToString());
        }
示例#3
0
        public override string ToString()
        {
            StringBuilder sb      = new StringBuilder();
            Type          retType = ReturnType;

            if (Type.ShouldPrintFullName(retType))
            {
                sb.Append(retType.ToString());
            }
            else
            {
                sb.Append(retType.Name);
            }
            sb.Append(" ");
            sb.Append(Name);
            if (IsGenericMethod)
            {
                Type[] gen_params = 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("]");
            }
            sb.Append("(");

            var p = GetParametersInternal();

            ParameterInfo.FormatParameters(sb, p);

            if ((CallingConvention & CallingConventions.VarArgs) != 0)
            {
                if (p.Length > 0)
                {
                    sb.Append(", ");
                }
                sb.Append("...");
            }

            sb.Append(")");
            return(sb.ToString());
        }
示例#4
0
        private string FormatNameAndSig(bool serialization)
        {
            StringBuilder sbName = new StringBuilder(PropertyType.FormatTypeName(serialization));

            sbName.Append(" ");
            sbName.Append(Name);

            var pi = GetIndexParameters();

            if (pi.Length > 0)
            {
                sbName.Append(" [");
                ParameterInfo.FormatParameters(sbName, pi, 0, serialization);
                sbName.Append("]");
            }

            return(sbName.ToString());
        }
示例#5
0
        internal override string FormatNameAndSig(bool serialization)
        {
            // Serialization uses ToString to resolve MethodInfo overloads.
            StringBuilder sbName = new StringBuilder(Name);

            // serialization == true: use unambiguous (except for assembly name) type names to distinguish between overloads.
            // serialization == false: use basic format to maintain backward compatibility of MethodInfo.ToString().
            TypeNameFormatFlags format = serialization ? TypeNameFormatFlags.FormatSerialization : TypeNameFormatFlags.FormatBasic;

            if (IsGenericMethod)
            {
                sbName.Append(RuntimeMethodHandle.ConstructInstantiation(this, format));
            }

            sbName.Append("(");
            ParameterInfo.FormatParameters(sbName, GetParametersNoCopy(), CallingConvention, serialization);
            sbName.Append(")");

            return(sbName.ToString());
        }