Table of Contents

Struct Equality<T>

Namespace
LfrlAnvil
Assembly
LfrlAnvil.Core.dll

A lightweight representation of an equality comparison of two generic values.

public readonly struct Equality<T> : IEquatable<Equality<T>>

Type Parameters

T

Value type.

Implements
Inherited Members
Extension Methods

Constructors

Equality(T?, T?)

Creates a new Equality<T> instance.

public Equality(T? first, T? second)

Parameters

first T

First value to compare.

second T

Second value to compare.

Fields

First

First value to compare.

public readonly T? First

Field Value

T

Result

First and Second equality comparison result.

public readonly bool Result

Field Value

bool

Second

Second value to compare.

public readonly T? Second

Field Value

T

Methods

Equals(Equality<T>)

Indicates whether the current object is equal to another object of the same type.

[Pure]
public bool Equals(Equality<T> other)

Parameters

other Equality<T>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

[Pure]
public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

[Pure]
public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns a string representation of this Equality<T> instance.

[Pure]
public override string ToString()

Returns

string

String representation.

Operators

operator ==(Equality<T>, Equality<T>)

Checks if a is equal to b.

[Pure]
public static bool operator ==(Equality<T> a, Equality<T> b)

Parameters

a Equality<T>

First operand.

b Equality<T>

Second operand.

Returns

bool

true when operands are equal, otherwise false.

implicit operator bool(Equality<T>)

Returns Result of e.

[Pure]
public static implicit operator bool(Equality<T> e)

Parameters

e Equality<T>

Operand.

Returns

bool

Result of e.

operator !=(Equality<T>, Equality<T>)

Checks if a is not equal to b.

[Pure]
public static bool operator !=(Equality<T> a, Equality<T> b)

Parameters

a Equality<T>

First operand.

b Equality<T>

Second operand.

Returns

bool

true when operands are not equal, otherwise false.

operator !(Equality<T>)

Returns negated Result of e.

[Pure]
public static bool operator !(Equality<T> e)

Parameters

e Equality<T>

Operand.

Returns

bool

Negated Result of e.