ToString() public method

public ToString ( ) : String
return String
Exemplo n.º 1
0
 internal ConcatString(ConcatString str1, String str2){
   this.length = str1.length+str2.Length;
   if (str1.isOwner){
     this.buf = str1.buf;
     str1.isOwner = false;
   }else{
     int capacity = this.length*2;
     if (capacity < 256) capacity = 256;
     this.buf = new StringBuilder(str1.ToString(), capacity);
   }
   this.buf.Append(str2);
   this.isOwner = true;
 }
Exemplo n.º 2
0
 internal ConcatString(ConcatString str1, String str2)
 {
     this.length = str1.length + str2.Length;
     if (str1.isOwner)
     {
         this.buf     = str1.buf;
         str1.isOwner = false;
     }
     else
     {
         int capacity = this.length * 2;
         if (capacity < 256)
         {
             capacity = 256;
         }
         this.buf = new StringBuilder(str1.ToString(), capacity);
     }
     this.buf.Append(str2);
     this.isOwner = true;
 }
Exemplo n.º 3
0
        public static String toString(Object thisob)
        {
            StringObject strob = thisob as StringObject;

            if (strob != null)
            {
                return(strob.value);
            }
            ConcatString concatStr = thisob as ConcatString;

            if (concatStr != null)
            {
                return(concatStr.ToString());
            }
            IConvertible ic = Convert.GetIConvertible(thisob);

            if (Convert.GetTypeCode(thisob, ic) == TypeCode.String)
            {
                return(ic.ToString(null));
            }
            throw new JScriptException(JSError.StringExpected);
        }
        public static string toString(object thisob)
        {
            StringObject obj2 = thisob as StringObject;

            if (obj2 != null)
            {
                return(obj2.value);
            }
            ConcatString str = thisob as ConcatString;

            if (str != null)
            {
                return(str.ToString());
            }
            IConvertible iConvertible = Microsoft.JScript.Convert.GetIConvertible(thisob);

            if (Microsoft.JScript.Convert.GetTypeCode(thisob, iConvertible) != TypeCode.String)
            {
                throw new JScriptException(JSError.StringExpected);
            }
            return(iConvertible.ToString(null));
        }