Class ProtobufEqualityComparers (3.15.8)

public static class ProtobufEqualityComparers : object

Provides a central place to implement equality comparisons, primarily for bitwise float/double equality.

Inheritance

Object > ProtobufEqualityComparers

Namespace

Google.Protobuf.Collections

Assembly

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
TypeDescription
EqualityComparer<Double>

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
TypeDescription
EqualityComparer<Nullable<Double>>

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
TypeDescription
EqualityComparer<Nullable<Single>>

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
TypeDescription
EqualityComparer<Single>

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
TypeDescription
EqualityComparer<T>

The equality comparer.

Type Parameter
NameDescription
T

The type of equality comparer to return.