aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/FieldCodec.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf/FieldCodec.cs')
-rw-r--r--csharp/src/Google.Protobuf/FieldCodec.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/csharp/src/Google.Protobuf/FieldCodec.cs b/csharp/src/Google.Protobuf/FieldCodec.cs
index c28b47e1..a11f2420 100644
--- a/csharp/src/Google.Protobuf/FieldCodec.cs
+++ b/csharp/src/Google.Protobuf/FieldCodec.cs
@@ -30,6 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
+using Google.Protobuf.Collections;
using Google.Protobuf.Compatibility;
using Google.Protobuf.WellKnownTypes;
using System;
@@ -346,6 +347,7 @@ namespace Google.Protobuf
/// </remarks>
public sealed class FieldCodec<T>
{
+ private static readonly EqualityComparer<T> EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>();
private static readonly T DefaultDefault;
// Only non-nullable value types support packing. This is the simplest way of detecting that.
private static readonly bool TypeSupportsPacking = default(T) != null;
@@ -469,6 +471,6 @@ namespace Google.Protobuf
/// </summary>
public int CalculateSizeWithTag(T value) => IsDefault(value) ? 0 : ValueSizeCalculator(value) + tagSize;
- private bool IsDefault(T value) => EqualityComparer<T>.Default.Equals(value, DefaultValue);
+ private bool IsDefault(T value) => EqualityComparer.Equals(value, DefaultValue);
}
}