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.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public sealed class BitwiseComparer<T> : IEqualityComparer<T>, IComparer<T> where T : struct
Type Parameters
Name Description
T

The value type.

Properties

| Improve this Doc 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

| Improve this Doc View Source

Compare<TOther>(T, TOther)

Compares bits of two values of the different type.

Declaration
public static int Compare<TOther>(in T first, in TOther second)

    where TOther : struct
Parameters
Type Name Description
T first

The first value to compare.

TOther second

The second value to compare.

Returns
Type Description
Int32

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

Type Parameters
Name Description
TOther

Type of the second value.

| Improve this Doc View Source

Equals<TOther>(T, 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 : struct
Parameters
Type Name Description
T first

The first value to check.

TOther second

The second value to check.

Returns
Type Description
Boolean

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.

| Improve this Doc View Source

GetHashCode(T, Boolean)

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.

Boolean salted

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

Returns
Type Description
Int32

Content hash code.

| Improve this Doc View Source

GetHashCode(T, Int32, ValueFunc<Int32, Int32, Int32>, Boolean)

Computes bitwise hash code for the specified value.

Declaration
public static int GetHashCode(in T value, int hash, in ValueFunc<int, int, int> hashFunction, bool salted)
Parameters
Type Name Description
T value

A value to be hashed.

Int32 hash

Initial value of the hash.

ValueFunc<Int32, Int32, Int32> hashFunction

Hashing function.

Boolean salted

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

Returns
Type Description
Int32

Bitwise hash code.

Remarks

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

| Improve this Doc View Source

GetHashCode(T, Int32, Func<Int32, Int32, Int32>, Boolean)

Computes bitwise hash code for the specified value.

Declaration
public static int GetHashCode(in T value, int hash, Func<int, int, int> hashFunction, bool salted = true)
Parameters
Type Name Description
T value

A value to be hashed.

Int32 hash

Initial value of the hash.

Func<Int32, Int32, Int32> hashFunction

Hashing function.

Boolean salted

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

Returns
Type Description
Int32

Bitwise hash code.

Remarks

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

Explicit Interface Implementations

| Improve this Doc View Source

IComparer<T>.Compare(T, T)

Declaration
int IComparer<T>.Compare(T x, T y)
Parameters
Type Name Description
T x
T y
Returns
Type Description
Int32
| Improve this Doc View Source

IEqualityComparer<T>.Equals(T, T)

Declaration
bool IEqualityComparer<T>.Equals(T x, T y)
Parameters
Type Name Description
T x
T y
Returns
Type Description
Boolean
| Improve this Doc View Source

IEqualityComparer<T>.GetHashCode(T)

Declaration
int IEqualityComparer<T>.GetHashCode(T obj)
Parameters
Type Name Description
T obj
Returns
Type Description
Int32

Implements

System.Collections.Generic.IEqualityComparer<T>
System.Collections.Generic.IComparer<T>

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX