Explorar o código

Optimizing Fortunes ordering (#3680)

Sébastien Ros %!s(int64=7) %!d(string=hai) anos
pai
achega
e84de60ab5
Modificáronse 1 ficheiros con 2 adicións e 9 borrados
  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);
         }
     }
 }