Table of Contents

Class Tlv

Namespace
NLightning.Common.Types
Assembly
NLightning.Common.dll

A TLV (Type-Length-Value) object

public class Tlv : IEquatable<Tlv>
Inheritance
Tlv
Implements
Derived
Inherited Members

Constructors

Tlv(BigSize, BigSize, byte[])

A TLV (Type-Length-Value) object

public Tlv(BigSize type, BigSize length, byte[] value)

Parameters

type BigSize

A message-specific, 64-bit identifier for the TLV

length BigSize

The length of the value

value byte[]

The value

Tlv(BigSize, byte[])

Create a new TLV

public Tlv(BigSize type, byte[] value)

Parameters

type BigSize

The type of the TLV

value byte[]

The value of the TLV

Remarks

The length of the value is automatically calculated

Properties

Length

The length of the value

public BigSize Length { get; }

Property Value

BigSize

Type

The type of the TLV

public BigSize Type { get; }

Property Value

BigSize

Value

The value

public byte[] Value { get; }

Property Value

byte[]

Methods

DeserializeAsync(Stream)

Deserialize a TLV from a stream

public static Task<Tlv> DeserializeAsync(Stream stream)

Parameters

stream Stream

The stream to use

Returns

Task<Tlv>

The TLV

Exceptions

SerializationException

Error deserializing TLV or any of it's parts

Equals(Tlv?)

Check if two TLVs are equal

public bool Equals(Tlv? other)

Parameters

other Tlv

The other TLV

Returns

bool

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

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

SerializeAsync(Stream)

Serialize the TLV to a stream

public Task SerializeAsync(Stream stream)

Parameters

stream Stream

The stream to write to

Returns

Task

A task that represents the asynchronous operation

Exceptions

SerializationException

Error serializing TLV or any of it's parts