Table of Contents

Struct RequestId

Namespace
StreamJsonRpc
Assembly
StreamJsonRpc.dll

Represents the ID of a request, whether it is a number or a string.

[JsonConverter(typeof(RequestIdJsonConverter))]
public struct RequestId : IEquatable<RequestId>
Implements
Inherited Members

Constructors

RequestId(long)

Initializes a new instance of the RequestId struct.

public RequestId(long id)

Parameters

id long

The ID of the request.

RequestId(string?)

Initializes a new instance of the RequestId struct.

public RequestId(string? id)

Parameters

id string

The ID of the request.

Properties

IsEmpty

Gets a value indicating whether the request ID was not specified (i.e. no string, number or null was given).

public bool IsEmpty { get; }

Property Value

bool

IsNull

Gets a value indicating whether this request ID is explicitly specified as the special "null" value.

public readonly bool IsNull { get; }

Property Value

bool

NotSpecified

Gets an empty (absent) ID.

public static RequestId NotSpecified { get; }

Property Value

RequestId

Null

Gets the special value for an explicitly specified null request ID.

public static RequestId Null { get; }

Property Value

RequestId

Number

Gets the ID if it is a number.

public readonly long? Number { get; }

Property Value

long?

String

Gets the ID if it is a string.

public readonly string? String { get; }

Property Value

string

Methods

Equals(RequestId)

public bool Equals(RequestId other)

Parameters

other RequestId

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(RequestId, RequestId)

Tests equality between two RequestId values.

public static bool operator ==(RequestId first, RequestId second)

Parameters

first RequestId

The first value.

second RequestId

The second value.

Returns

bool

true if the values are equal; false otherwise.

operator !=(RequestId, RequestId)

Tests inequality between two RequestId values.

public static bool operator !=(RequestId first, RequestId second)

Parameters

first RequestId

The first value.

second RequestId

The second value.

Returns

bool

false if the values are equal; true otherwise.