<PackageReference Include="Google.Protobuf" Version="3.34.2" />

Google.Protobuf.Collections.ProtobufEqualityComparers

public static class ProtobufEqualityComparers
Provides a central place to implement equality comparisons, primarily for bitwise float/double equality.
public static EqualityComparer<double> BitwiseDoubleEqualityComparer { get; }

Returns an equality comparer suitable for comparing 64-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.)

Returns an equality comparer suitable for comparing nullable 64-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.)

Returns an equality comparer suitable for comparing nullable 32-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.)

public static EqualityComparer<float> BitwiseSingleEqualityComparer { get; }

Returns an equality comparer suitable for comparing 32-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.)

public static EqualityComparer<T> GetEqualityComparer<T>()

Returns an equality comparer for T suitable for Protobuf equality comparisons. This is usually just the default equality comparer for the type, but floating point numbers are compared bitwise.