Class Metadata
A collection of metadata entries that can be exchanged during a call. gRPC supports these types of metadata:
- Request headersare sent by the client at the beginning of a remote call before any request messages are sent.
- Response headersare sent by the server at the beginning of a remote call handler before any response messages are sent.
- Response trailersare sent by the server at the end of a remote call along with resulting call status.
Inheritance
System.Object
Metadata
Implements
System.Collections.Generic.IList<Metadata.Entry>
System.Collections.Generic.ICollection<Metadata.Entry>
System.Collections.Generic.IEnumerable<Metadata.Entry>
System.Collections.IEnumerable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public sealed class Metadata : IList<Metadata.Entry>, ICollection<Metadata.Entry>, IEnumerable<Metadata.Entry>, IEnumerable
Constructors
Metadata()
Initializes a new instance of Metadata
.
Declaration
public Metadata()
Fields
BinaryHeaderSuffix
All binary headers should have this suffix.
Declaration
public const string BinaryHeaderSuffix = "-bin"
Field Value
Type | Description |
---|---|
System.String |
Empty
An read-only instance of metadata containing no entries.
Declaration
public static readonly Metadata Empty
Field Value
Type | Description |
---|---|
Metadata |
Properties
Count
IList`1
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
System.Collections.Generic.ICollection<T>.Count
IsReadOnly
IList`1
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
System.Collections.Generic.ICollection<T>.IsReadOnly
Item[Int32]
IList`1
Declaration
public Metadata.Entry this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
Metadata.Entry |
Implements
System.Collections.Generic.IList<T>.Item[System.Int32]
Methods
Add(Metadata.Entry)
IList`1
Declaration
public void Add(Metadata.Entry item)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Entry | item |
Implements
System.Collections.Generic.ICollection<T>.Add(T)
Add(String, Byte[])
Adds a new binary-valued metadata entry. See Metadata.Entry
constructor for params.
Declaration
public void Add(string key, byte[] valueBytes)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.Byte[] | valueBytes |
Add(String, String)
Adds a new ASCII-valued metadata entry. See Metadata.Entry
constructor for params.
Declaration
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.String | value |
Clear()
IList`1
Declaration
public void Clear()
Implements
System.Collections.Generic.ICollection<T>.Clear()
Contains(Metadata.Entry)
IList`1
Declaration
public bool Contains(Metadata.Entry item)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Entry | item |
Returns
Type | Description |
---|---|
System.Boolean |
Implements
System.Collections.Generic.ICollection<T>.Contains(T)
CopyTo(Metadata.Entry[], Int32)
IList`1
Declaration
public void CopyTo(Metadata.Entry[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Entry[] | array | |
System.Int32 | arrayIndex |
Implements
System.Collections.Generic.ICollection<T>.CopyTo(T[], System.Int32)
GetEnumerator()
IList`1
Declaration
public IEnumerator<Metadata.Entry> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<Metadata.Entry> |
Implements
System.Collections.Generic.IEnumerable<T>.GetEnumerator()
IndexOf(Metadata.Entry)
IList`1
Declaration
public int IndexOf(Metadata.Entry item)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Entry | item |
Returns
Type | Description |
---|---|
System.Int32 |
Implements
System.Collections.Generic.IList<T>.IndexOf(T)
Insert(Int32, Metadata.Entry)
IList`1
Declaration
public void Insert(int index, Metadata.Entry item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
Metadata.Entry | item |
Implements
System.Collections.Generic.IList<T>.Insert(System.Int32, T)
Remove(Metadata.Entry)
IList`1
Declaration
public bool Remove(Metadata.Entry item)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Entry | item |
Returns
Type | Description |
---|---|
System.Boolean |
Implements
System.Collections.Generic.ICollection<T>.Remove(T)
RemoveAt(Int32)
IList`1
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Implements
System.Collections.Generic.IList<T>.RemoveAt(System.Int32)
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Implements
System.Collections.IEnumerable.GetEnumerator()