Jelajahi Sumber

Optimizing Fortunes ordering (#3680)

Sébastien Ros 7 tahun lalu
induk
melakukan
e84de60ab5
1 mengubah file dengan 2 tambahan dan 9 penghapusan
  1. 2 9
      frameworks/CSharp/aspnetcore/Benchmarks/Data/Fortune.cs

+ 2 - 9
frameworks/CSharp/aspnetcore/Benchmarks/Data/Fortune.cs

@@ -19,19 +19,12 @@ namespace Benchmarks.Data
         
         public int CompareTo(object obj)
         {
-            var other = obj as Fortune;
-
-            if (other == null)
-            {
-                throw new ArgumentException($"Object to compare must be of type {nameof(Fortune)}", nameof(obj));
-            }
-
-            return CompareTo(other);
+            return CompareTo((Fortune)obj);
         }
 
         public int CompareTo(Fortune other)
         {
-            return Message.CompareTo(other.Message);
+            return String.CompareOrdinal(Message, other.Message);
         }
     }
 }