ToString() public method

public ToString ( ) : string
return string
Exemplo n.º 1
0
        public override string ToString()
        {
            {
                StringBuilder sb = new StringBuilder();

                if (IsDef())
                {
                    sb.Append(name);
                    if (constraintGenericTypeVar != null)
                    {
                        sb.Append(" : ").Append(constraintGenericTypeVar.name);
                    }
                    else if (constraintClassDescriptor != null)
                    {
                        sb.Append(" : ").Append(constraintClassDescriptor.DescribedClassSimpleName);
                        if (constraintGenericTypeVarArgs != null && constraintGenericTypeVarArgs.Count > 0)
                        {
                            sb.Append("<");
                            for (int i = 0; i < constraintGenericTypeVarArgs.Count; ++i)
                            {
                                GenericTypeVar g = constraintGenericTypeVarArgs[i];
                                sb.Append(i == 0 ? "" : ",").Append(g.ToString());
                            }
                            sb.Append(">");
                        }
                    }
                }
                else
                {
                    if (name != null || referredGenericTypeVar != null)
                    {
                        sb.Append(name);
                    }
                    else if (classDescriptor != null)
                    {
                        sb.Append(classDescriptor.DescribedClassSimpleName);
                        if (genericTypeVarArgs != null && genericTypeVarArgs.Count > 0)
                        {
                            sb.Append("<");
                            for (int i = 0; i < genericTypeVarArgs.Count; ++i)
                            {
                                GenericTypeVar g = genericTypeVarArgs[i];
                                sb.Append(i == 0 ? "" : ",").Append(g.ToString());
                            }
                            sb.Append(">");
                        }
                    }
                }

                return(sb.ToString());
            }
        }