Эх сурвалжийг харах

Optimizing Fortunes ordering (#3680)

Sébastien Ros 7 жил өмнө
parent
commit
e84de60ab5

+ 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);
         }
     }
 }