Table of Contents

Struct DerivedTypeIdentifier

Namespace
Nerdbank.Json
Assembly
Nerdbank.Json.dll

Identifies a derived type using a string or integer alias.

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 integer alias.

DerivedTypeIdentifier(string)

Initializes a new instance of the DerivedTypeIdentifier struct.

public DerivedTypeIdentifier(string alias)

Parameters

alias string

The string alias.

Properties

IntAlias

Gets the integer alias.

public int IntAlias { get; }

Property Value

int

Exceptions

InvalidOperationException

The identifier is not an integer.

StringAlias

Gets the string alias.

public string StringAlias { get; }

Property Value

string

Exceptions

InvalidOperationException

The identifier is not a string.

Type

Gets the alias kind.

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

The identifier is not a 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 integer to an identifier.

public static implicit operator DerivedTypeIdentifier(int alias)

Parameters

alias int

The alias.

Returns

DerivedTypeIdentifier

implicit operator DerivedTypeIdentifier(string)

Converts a string to an identifier.

public static implicit operator DerivedTypeIdentifier(string alias)

Parameters

alias string

The alias.

Returns

DerivedTypeIdentifier