public static class ProtobufEqualityComparers
Provides a central place to implement equality comparisons, primarily for bitwise float/double equality.
Namespace
Google.Protobuf.CollectionsAssembly
Google.Protobuf.dll
Properties
BitwiseDoubleEqualityComparer
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.)
Property Value | |
---|---|
Type | Description |
EqualityComparerdouble |
BitwiseNullableDoubleEqualityComparer
public static EqualityComparer<double?> BitwiseNullableDoubleEqualityComparer { get; }
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.)
Property Value | |
---|---|
Type | Description |
EqualityComparerdouble |
BitwiseNullableSingleEqualityComparer
public static EqualityComparer<float?> BitwiseNullableSingleEqualityComparer { get; }
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.)
Property Value | |
---|---|
Type | Description |
EqualityComparerfloat |
BitwiseSingleEqualityComparer
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.)
Property Value | |
---|---|
Type | Description |
EqualityComparerfloat |
Methods
GetEqualityComparer<T>()
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.
Returns | |
---|---|
Type | Description |
EqualityComparer |
The equality comparer. |
Type Parameter | |
---|---|
Name | Description |
T |
The type of equality comparer to return. |