public override string ToString()
        {
            if (IsPrimitive)
            {
                return(CSharpName);
            }

            string typename = "";

            if (!IsEmpty)
            {
                typename = CSharpName;
            }
            if (typename == "")
            {
                typename = "object";
            }

            if (IsArray)
            {
                typename = $"{ElementType?.ToString() ?? "object"}[]";
            }
            else if (IsGenericType && GenericTypeParameters.Any())
            {
                typename = Name.Split("`")[0] + "<";
                foreach (LookupType t in GenericTypeParameters)
                {
                    typename += t.ToString() + (GenericTypeParameters[GenericTypeParameters.Count() - 1] != t ? ", " : "");
                }
                typename += ">";
            }
            else
            {
                typename = CSharpName;
            }
            return(typename);
        }
Esempio n. 2
0
        public override string ToString()
        {
            if (IsPrimitive)
            {
                return(CSharpName);
            }

            StringBuilder typename = new StringBuilder();

            if (!IsEmpty)
            {
                typename.Append(CSharpName);
            }

            if (IsArray)
            {
                typename.Clear();
                typename.Append($"{ElementType?.ToString() ?? "object"}[]");
            }
            else if (IsGenericType && GenericTypeParameters.Any())
            {
                typename.Clear();
                typename.Append(Name.Split("`")[0] + "<");
                foreach (UnitorType t in GenericTypeParameters)
                {
                    typename.Append(t.ToString() + (GenericTypeParameters[GenericTypeParameters.Count() - 1] != t ? ", " : ""));
                }
                typename.Append('>');
            }

            if (typename.Length == 0)
            {
                typename.Append("object");
            }

            return(typename.ToString());
        }