Table of Contents

Struct JsonRpcValue

Namespace
Nerdbank.JsonRpc
Assembly
Nerdbank.JsonRpc.dll

An owned, encoded application value. The default value represents absence, not JSON null.

public readonly struct JsonRpcValue : IEquatable<JsonRpcValue>
Implements
Inherited Members

Properties

Bytes

Gets a copy of the encoded bytes.

public ReadOnlyMemory<byte> Bytes { get; }

Property Value

ReadOnlyMemory<byte>

Encoding

Gets the encoding of this value.

public JsonRpcEncoding Encoding { get; }

Property Value

JsonRpcEncoding

HasValue

Gets a value indicating whether this value is present.

public bool HasValue { get; }

Property Value

bool

Methods

AsMessagePack()

Returns this value as MessagePack, rejecting any other encoding.

public RawMessagePack AsMessagePack()

Returns

RawMessagePack

The MessagePack value.

Equals(JsonRpcValue)

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

public bool Equals(JsonRpcValue other)

Parameters

other JsonRpcValue

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.

FromJson(ReadOnlySequence<byte>)

Copies raw UTF-8 JSON bytes into an owned buffer without validating them.

public static JsonRpcValue FromJson(ReadOnlySequence<byte> utf8)

Parameters

utf8 ReadOnlySequence<byte>

A complete UTF-8 JSON value supplied by the caller.

Returns

JsonRpcValue

The owned value.

FromJson(ReadOnlyMemory<byte>)

Copies raw UTF-8 JSON bytes into an owned buffer without validating them.

public static JsonRpcValue FromJson(ReadOnlyMemory<byte> utf8)

Parameters

utf8 ReadOnlyMemory<byte>

A complete UTF-8 JSON value supplied by the caller.

Returns

JsonRpcValue

The owned value.

FromMessagePack(RawMessagePack)

Copies raw MessagePack bytes into an owned buffer without validating them.

public static JsonRpcValue FromMessagePack(RawMessagePack value)

Parameters

value RawMessagePack

A complete MessagePack value supplied by the caller.

Returns

JsonRpcValue

The owned value.

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 RawMessagePack(JsonRpcValue)

Extracts a MessagePack value, rejecting JSON.

public static implicit operator RawMessagePack(JsonRpcValue value)

Parameters

value JsonRpcValue

The tagged value.

Returns

RawMessagePack

implicit operator JsonRpcValue(RawMessagePack)

Converts a MessagePack raw value into a tagged value.

public static implicit operator JsonRpcValue(RawMessagePack value)

Parameters

value RawMessagePack

The raw value.

Returns

JsonRpcValue