Ejemplo n.º 1
0
        internal static string ParameterToString(ParameterInfo Parameter)
        {
            string str1 = "";
            Type   typ  = Parameter.ParameterType;

            if (Parameter.IsOptional)
            {
                str1 += "[";
            }
            if (typ.IsByRef)
            {
                str1 += "ByRef ";
                typ   = typ.GetElementType();
            }
            else if (Symbols.IsParamArray(Parameter))
            {
                str1 += "ParamArray ";
            }
            string str2 = str1 + Parameter.Name + " As " + Utils.VBFriendlyNameOfType(typ, true);

            if (Parameter.IsOptional)
            {
                object defaultValue = Parameter.DefaultValue;
                if (defaultValue == null)
                {
                    str2 += " = Nothing";
                }
                else
                {
                    Type type = defaultValue.GetType();
                    if (type != Utils.VoidType)
                    {
                        str2 = !Symbols.IsEnum(type) ? str2 + " = " + Conversions.ToString(defaultValue) : str2 + " = " + Enum.GetName(type, defaultValue);
                    }
                }
                str2 += "]";
            }
            return(str2);
        }
Ejemplo n.º 2
0
 internal static bool IsIntrinsicType(Type Type)
 {
     return(Symbols.IsIntrinsicType(Symbols.GetTypeCode(Type)) && !Symbols.IsEnum(Type));
 }