Sébastien Ros 7 лет назад
Родитель
Сommit
e84de60ab5
1 измененных файлов с 2 добавлено и 9 удалено
  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);
         }
     }
 }