Пример #1
0
        internal static string ParameterToString(ParameterInfo Parameter)
        {
            string str2          = "";
            Type   parameterType = Parameter.ParameterType;

            if (Parameter.IsOptional)
            {
                str2 = str2 + "[";
            }
            if (parameterType.IsByRef)
            {
                str2          = str2 + "ByRef ";
                parameterType = parameterType.GetElementType();
            }
            else if (Symbols.IsParamArray(Parameter))
            {
                str2 = str2 + "ParamArray ";
            }
            str2 = str2 + Parameter.Name + " As " + VBFriendlyNameOfType(parameterType, true);
            if (!Parameter.IsOptional)
            {
                return(str2);
            }
            object defaultValue = Parameter.DefaultValue;

            if (defaultValue == null)
            {
                str2 = str2 + " = Nothing";
            }
            else
            {
                Type type = defaultValue.GetType();
                if (type != VoidType)
                {
                    if (Symbols.IsEnum(type))
                    {
                        str2 = str2 + " = " + Enum.GetName(type, defaultValue);
                    }
                    else
                    {
                        str2 = str2 + " = " + Conversions.ToString(defaultValue);
                    }
                }
            }
            return(str2 + "]");
        }