Show / Hide Table of Contents

Class BitwiseComparer<T>

Represents bitwise comparer for the arbitrary value type.

Inheritance
object
BitwiseComparer<T>
Implements
IEqualityComparer<T>
IComparer<T>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public sealed class BitwiseComparer<T> : IEqualityComparer<T>, IComparer<T> where T : unmanaged
Type Parameters
Name Description
T

The value type.

Properties

| Edit this page View Source

Instance

Gets instance of this comparer.

Declaration
public static BitwiseComparer<T> Instance { get; }
Property Value
Type Description
BitwiseComparer<T>

The instance of this comparer.

Remarks

Use this property only if you need object implementing IEqualityComparer<T> or IComparer<T> interface. Otherwise, use static methods.

Methods

| Edit this page View Source

Compare<TOther>(in T, in TOther)

Compares bits of two values of the different type.

Declaration
public static int Compare<TOther>(in T first, in TOther second) where TOther : unmanaged
Parameters
Type Name Description
T first

The first value to compare.

TOther second

The second value to compare.

Returns
Type Description
int

A value that indicates the relative order of the objects being compared.

Type Parameters
Name Description
TOther

Type of the second value.

| Edit this page View Source

Equals<TOther>(in T, in TOther)

Checks bitwise equality between two values of different value types.

Declaration
public static bool Equals<TOther>(in T first, in TOther second) where TOther : unmanaged
Parameters
Type Name Description
T first

The first value to check.

TOther second

The second value to check.

Returns
Type Description
bool

true, if both values are equal; otherwise, false.

Type Parameters
Name Description
TOther

Type of second value.

Remarks

This method doesn't use Equals(object) even if it is overridden by value type.

| Edit this page View Source

GetHashCode(in T, bool)

Computes hash code for the structure content.

Declaration
public static int GetHashCode(in T value, bool salted = true)
Parameters
Type Name Description
T value

Value to be hashed.

bool salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
int

Content hash code.

Implements

IEqualityComparer<T>
IComparer<T>

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾