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
Encoding
Gets the encoding of this value.
public JsonRpcEncoding Encoding { get; }
Property Value
HasValue
Gets a value indicating whether this value is present.
public bool HasValue { get; }
Property Value
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
otherJsonRpcValueAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
utf8ReadOnlySequence<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
utf8ReadOnlyMemory<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
valueRawMessagePackA 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
valueJsonRpcValueThe tagged value.
Returns
implicit operator JsonRpcValue(RawMessagePack)
Converts a MessagePack raw value into a tagged value.
public static implicit operator JsonRpcValue(RawMessagePack value)
Parameters
valueRawMessagePackThe raw value.