2003-04-11 Dietmar Maurer <dietmar@ximian.com>
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Fri, 11 Apr 2003 09:50:00 +0000 (09:50 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Fri, 11 Apr 2003 09:50:00 +0000 (09:50 -0000)
* String.cs (Equals): avoid the internal call, code cleanups

svn path=/trunk/mcs/; revision=13511

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/String.cs

index 5318954fff24ba170dd99a4ff4f9408c0c484e09..9da873772495b9620fcf59051770a17469483d11 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-11  Dietmar Maurer  <dietmar@ximian.com>
+
+       * String.cs (Equals): avoid the internal call, code cleanups
+
 2003-04-11  Alan Tam <Tam@SiuLung.com>
 
        * Convert.cs: fixed bug #41085.
index fbb8139f004d20ef9ce474fd7743fd7912dbda86..db847d269466f40dae21ec1aefc52a188640d884 100644 (file)
@@ -33,10 +33,16 @@ namespace System {
                        if (null == str1 || null == str2)
                                return false;
 
-                       if (str1.length != str2.length)
+                       int len = str1.length;
+                       
+                       if (len != str2.length)
                                return false;
 
-                       return InternalEquals(str1, str2);
+                       for (int i = 0; i < len; i++)
+                               if (str1 [i] != str2 [i])
+                                       return false;
+
+                       return true;
                }
 
                public static bool operator == (String str1, String str2) {
@@ -48,33 +54,11 @@ namespace System {
                }
 
                public override bool Equals(Object obj) {
-                       if ((this as object) == obj)
-                               return true;
-
-                       if (null == obj)
-                               return false;
-
-                       if (!(obj is String))
-                               return false;
-
-                       string other = (string) obj;
-                       if (length != other.length)
-                               return false;
-
-                       return InternalEquals(this, other);
+                       return Equals (this, obj as String);
                }
 
                public bool Equals(String value) {
-                       if ((this as object) == value)
-                               return true;
-
-                       if (null == value)
-                               return false;
-
-                       if (length != value.length)
-                               return false;
-
-                       return InternalEquals(this, value);
+                       return Equals (this, value);
                }
 
                [IndexerName("Chars")]