Table of Contents

Struct DerivedTypeIdentifier

Namespace
Nerdbank.MessagePack
Assembly
Nerdbank.MessagePack.dll

Acts as a type union between a string and an int, which are the allowed types for sub-type aliases.

public struct DerivedTypeIdentifier : IEquatable<DerivedTypeIdentifier>
Implements
Inherited Members

Constructors

DerivedTypeIdentifier(int)

Initializes a new instance of the DerivedTypeIdentifier struct.

public DerivedTypeIdentifier(int alias)

Parameters

alias int

The alias.

DerivedTypeIdentifier(string)

Initializes a new instance of the DerivedTypeIdentifier struct.

public DerivedTypeIdentifier(string alias)

Parameters

alias string

The alias.

Properties

IntAlias

Gets the int alias.

public int IntAlias { get; }

Property Value

int

Exceptions

InvalidOperationException

Thrown if Type is not Integer.

MsgPackAlias

Gets the msgpack encoding of the alias.

public ReadOnlyMemory<byte> MsgPackAlias { get; }

Property Value

ReadOnlyMemory<byte>

StringAlias

Gets the string alias.

public string StringAlias { get; }

Property Value

string

Exceptions

InvalidOperationException

Thrown if Type is not String.

Type

Gets the type of this alias.

public DerivedTypeIdentifier.AliasType Type { get; }

Property Value

DerivedTypeIdentifier.AliasType

Utf8Alias

Gets the UTF-8 encoding of the string alias.

public ReadOnlyMemory<byte> Utf8Alias { get; }

Property Value

ReadOnlyMemory<byte>

Exceptions

InvalidOperationException

Thrown if Type is not String.

Methods

Equals(DerivedTypeIdentifier)

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

public bool Equals(DerivedTypeIdentifier other)

Parameters

other DerivedTypeIdentifier

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.

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.

public override int GetHashCode()

Returns

int

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

Operators

implicit operator DerivedTypeIdentifier(int)

Converts an int to a DerivedTypeIdentifier instance.

public static implicit operator DerivedTypeIdentifier(int alias)

Parameters

alias int

The value of the type alias.

Returns

DerivedTypeIdentifier

implicit operator DerivedTypeIdentifier(string)

Converts an string to a DerivedTypeIdentifier instance.

public static implicit operator DerivedTypeIdentifier(string alias)

Parameters

alias string

The value of the type alias.

Returns

DerivedTypeIdentifier