Struct ChainHash
- Namespace
- NLightning.Domain.Protocol.ValueObjects
- Assembly
- NLightning.Domain.dll
Represents a chain hash.
public readonly struct ChainHash : IEquatable<ChainHash>, IValueObject
- Implements
- Inherited Members
Remarks
A chain hash is a 32-byte hash used to identify a chain.
Constructors
ChainHash(ReadOnlySpan<byte>)
Initializes a new instance of the ChainHash struct.
public ChainHash(ReadOnlySpan<byte> value)
Parameters
value
ReadOnlySpan<byte>The value of the chain hash.
Exceptions
- ArgumentOutOfRangeException
Thrown when the value is not 32 bytes.
Properties
Value
public byte[] Value { get; }
Property Value
- byte[]
Methods
Equals(ChainHash)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ChainHash other)
Parameters
other
ChainHashAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
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.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Operators
operator ==(ChainHash, ChainHash)
public static bool operator ==(ChainHash left, ChainHash right)
Parameters
Returns
implicit operator byte[](ChainHash)
public static implicit operator byte[](ChainHash c)
Parameters
Returns
- byte[]
implicit operator ReadOnlyMemory<byte>(ChainHash)
public static implicit operator ReadOnlyMemory<byte>(ChainHash c)
Parameters
Returns
implicit operator ChainHash(byte[])
public static implicit operator ChainHash(byte[] value)
Parameters
value
byte[]
Returns
operator !=(ChainHash, ChainHash)
public static bool operator !=(ChainHash left, ChainHash right)