# Class Metadata.Entry (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.Entry)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.Metadata.Entry)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.Metadata.Entry)

    public class Metadata.Entry

Metadata entry

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Metadata.Entry

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

## Namespace

[Grpc.Core](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/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](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.Entry) struct with a binary value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://learn.microsoft.com/dotnet/api/system.string` Metadata key. Gets converted to lowercase. Needs to have `-bin` suffix indicating a binary-valued metadata entry. The binary header suffix can be added to the key with [BinaryHeaderSuffix](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata#Grpc_Core_Metadata_BinaryHeaderSuffix). Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots. |
| `valueBytes` | `System.Byte` Value bytes. |

### Entry(string, string)

    public Entry(string key, string value)

Initializes a new instance of the [Metadata.Entry](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.Entry) struct with an ASCII value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://learn.microsoft.com/dotnet/api/system.string` Metadata key. Gets converted to lowercase. Must not use '-bin' suffix indicating a binary-valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.string` 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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Key

    public string Key { get; }

Gets the metadata entry key.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `System.Byte` |   |

## Methods

### ToString()

    public override string ToString()

Returns a [string](https://learn.microsoft.com/dotnet/api/system.string) that represents the current [Metadata.Entry](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.Entry).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)