Author: kornelpal
Date: 2006-07-19 07:46:44 -0400 (Wed, 19 Jul 2006)
New Revision: 62740

Modified:
   trunk/mcs/class/corlib/System/ChangeLog
   trunk/mcs/class/corlib/System/String.cs
Log:
String.cs: Improve CreateString () performance when length is zero.

Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog     2006-07-19 11:26:39 UTC (rev 
62739)
+++ trunk/mcs/class/corlib/System/ChangeLog     2006-07-19 11:46:44 UTC (rev 
62740)
@@ -1,3 +1,7 @@
+2006-07-19  Kornél Pál  <[EMAIL PROTECTED]>
+
+       * String.cs: Improve CreateString () performance when length is zero.
+
 2006-07-18  Kornél Pál  <[EMAIL PROTECTED]>
 
        * String.cs: Added CreateString () methods. Constructors with matching

Modified: trunk/mcs/class/corlib/System/String.cs
===================================================================
--- trunk/mcs/class/corlib/System/String.cs     2006-07-19 11:26:39 UTC (rev 
62739)
+++ trunk/mcs/class/corlib/System/String.cs     2006-07-19 11:46:44 UTC (rev 
62740)
@@ -1896,12 +1896,14 @@
                        bool isDefaultEncoding;
 
                        if (isDefaultEncoding = (enc == null)) {
+#if NET_2_0
                                if (value == null)
-#if NET_2_0
                                        throw new ArgumentNullException 
("value");
+                               if (length == 0)
 #else
+                               if (value == null || length == 0)
+#endif
                                        return String.Empty;
-#endif
 
                                enc = Encoding.Default;
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to