Class ProtobufEqualityComparers
Provides a central place to implement equality comparisons, primarily for bitwise float/double equality.
Inheritance
Inherited Members
Namespace: Google.Protobuf.Collections
Assembly: Google.Protobuf.dll
Syntax
public static class ProtobufEqualityComparers
Properties
BitwiseDoubleEqualityComparer
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.)
Declaration
public static EqualityComparer<double> BitwiseDoubleEqualityComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.EqualityComparer<System.Double> |
BitwiseNullableDoubleEqualityComparer
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.)
Declaration
public static EqualityComparer<double? > BitwiseNullableDoubleEqualityComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.EqualityComparer<System.Nullable<System.Double>> |
BitwiseNullableSingleEqualityComparer
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.)
Declaration
public static EqualityComparer<float? > BitwiseNullableSingleEqualityComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.EqualityComparer<System.Nullable<System.Single>> |
BitwiseSingleEqualityComparer
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.)
Declaration
public static EqualityComparer<float> BitwiseSingleEqualityComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.EqualityComparer<System.Single> |
Methods
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.
Declaration
public static EqualityComparer<T> GetEqualityComparer<T>()
Returns
Type | Description |
---|---|
System.Collections.Generic.EqualityComparer<T> | The equality comparer. |
Type Parameters
Name | Description |
---|---|
T | The type of equality comparer to return. |