Table of Contents

Class ByteArrayEqualityComparer

Namespace
AsmResolver
Assembly
AsmResolver.dll

Provides an implementation to compare byte arrays for equality.

public class ByteArrayEqualityComparer : IEqualityComparer<byte[]>, IComparer<byte[]>, IAlternateEqualityComparer<ReadOnlySpan<byte>, byte[]>
Inheritance
ByteArrayEqualityComparer
Implements
Inherited Members

Properties

Instance

Gets the singleton instance of this comparer.

public static ByteArrayEqualityComparer Instance { get; }

Property Value

ByteArrayEqualityComparer

Methods

Compare(byte[]?, byte[]?)

Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.

public int Compare(byte[]? x, byte[]? y)

Parameters

x byte[]

The first object to compare.

y byte[]

The second object to compare.

Returns

int

A signed integer that indicates the relative values of x and y, as shown in the following table.

Value Meaning
Less than zerox is less than y.
Zerox equals y.
Greater than zerox is greater than y.

Create(ReadOnlySpan<byte>)

Creates a T that is considered by Equals(TAlternate, T) to be equal to the specified alternate.

public byte[] Create(ReadOnlySpan<byte> alternate)

Parameters

alternate ReadOnlySpan<byte>

The instance of type ReadOnlySpan<byte> for which an equal T is required.

Returns

byte[]

A T considered equal to the specified alternate.

Equals(byte[]?, byte[]?)

Determines whether the specified objects are equal.

public bool Equals(byte[]? x, byte[]? y)

Parameters

x byte[]

The first object of type T to compare.

y byte[]

The second object of type T to compare.

Returns

bool

true if the specified objects are equal; otherwise, false.

Equals(ReadOnlySpan<byte>, byte[])

Determines whether the specified alternate equals the specified other.

public bool Equals(ReadOnlySpan<byte> alternate, byte[] other)

Parameters

alternate ReadOnlySpan<byte>

The instance of type ReadOnlySpan<byte> to compare.

other byte[]

The instance of type T to compare.

Returns

bool

true if the specified instances are equal; otherwise, false.

GetHashCode(byte[])

Returns a hash code for the specified object.

public int GetHashCode(byte[] obj)

Parameters

obj byte[]

The object for which a hash code is to be returned.

Returns

int

A hash code for the specified object.

Exceptions

ArgumentNullException

The type of obj is a reference type and obj is null.

GetHashCode(ReadOnlySpan<byte>)

Returns a hash code for the specified alternate instance.

public int GetHashCode(ReadOnlySpan<byte> alternate)

Parameters

alternate ReadOnlySpan<byte>

The instance of type ReadOnlySpan<byte> for which to get a hash code.

Returns

int

A hash code for the specified instance.