# Class ProtobufEqualityComparers (3.27.1)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.27.1 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.ProtobufEqualityComparers)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Collections.ProtobufEqualityComparers)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Collections.ProtobufEqualityComparers)

    public static class ProtobufEqualityComparers

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

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ProtobufEqualityComparers

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Protobuf.Collections](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.equalitycomparer-1https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.equalitycomparer-1https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.equalitycomparer-1https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.equalitycomparer-1https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.equalitycomparer-1` | The equality comparer. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` | The type of equality comparer to return. |