Class Metadata.Entry (2.48.0)

public class Entry : object

Metadata entry

Inheritance

Object > Metadata.Entry

Namespace

Grpc.Core

Assembly

Grpc.Core.Api.dll

Constructors

Entry(String, Byte[])

public Entry(string key, byte[] valueBytes)

Initializes a new instance of the Metadata.Entry struct with a binary value.

Parameters
NameDescription
keyString

Metadata key. Gets converted to lowercase. Needs to have suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots.

valueBytesByte[]

Value bytes.

Entry(String, String)

public Entry(string key, string value)

Initializes a new instance of the Metadata.Entry struct with an ASCII value.

Parameters
NameDescription
keyString

Metadata key. Gets converted to lowercase. Must not use suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots.

valueString

Value string. Only ASCII characters are allowed.

Properties

IsBinary

public bool IsBinary { get; }

Returns true if this entry is a binary-value entry.

Property Value
TypeDescription
Boolean

Key

public string Key { get; }

Gets the metadata entry key.

Property Value
TypeDescription
String

Value

public string Value { get; }

Gets the string value of this metadata entry. If the metadata entry is binary then an exception is thrown.

Property Value
TypeDescription
String

ValueBytes

public byte[] ValueBytes { get; }

Gets the binary value of this metadata entry. If the metadata entry is not binary the string value will be returned as ASCII encoded bytes.

Property Value
TypeDescription
Byte[]

Methods

ToString()

public override string ToString()

Returns a that represents the current Metadata.Entry.

Returns
TypeDescription
String