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
-
IEquatable<Equality<T>>
- Inherited Members
- Extension Methods
Constructors
Equality(T?, T?)
Creates a new Equality<T> instance.
public Equality(T? first, T? second)
Parameters
first
TFirst value to compare.
second
TSecond value to compare.
Fields
First
First value to compare.
public readonly T? First
Field Value
- T
Result
public readonly bool Result
Field Value
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
Equals(object?)
Indicates whether this instance and a specified object are equal.
[Pure]
public override bool Equals(object? obj)
Parameters
obj
objectThe 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
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
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
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.