diff options
Diffstat (limited to 'csharp/src/Google.Protobuf/Collections/RepeatedField.cs')
-rwxr-xr-x | csharp/src/Google.Protobuf/Collections/RepeatedField.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs index 6063ff61..c18b63e2 100755 --- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs +++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs @@ -51,6 +51,7 @@ namespace Google.Protobuf.Collections , IReadOnlyList<T> #endif { + private static readonly EqualityComparer<T> EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>(); private static readonly T[] EmptyArray = new T[0]; private const int MinArraySize = 8; @@ -434,7 +435,7 @@ namespace Google.Protobuf.Collections { return false; } - EqualityComparer<T> comparer = EqualityComparer<T>.Default; + EqualityComparer<T> comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (!comparer.Equals(array[i], other.array[i])) @@ -454,7 +455,7 @@ namespace Google.Protobuf.Collections public int IndexOf(T item) { ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); - EqualityComparer<T> comparer = EqualityComparer<T>.Default; + EqualityComparer<T> comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (comparer.Equals(array[i], item)) |