Improve docs

pull/22743/head
James Newton-King 5 years ago
parent 840c974a93
commit b8f2034c35
No known key found for this signature in database
GPG Key ID: A66B2F456BF5526
  1. 32
      src/csharp/Grpc.Core.Api/Metadata.cs

@ -76,7 +76,7 @@ namespace Grpc.Core
} }
/// <summary> /// <summary>
/// Gets the last metadata entry with the specified key. If no entries have the key then <c>null</c> is returned. /// Gets the last metadata entry with the specified key. If there are no matching entries then <c>null</c> is returned.
/// </summary> /// </summary>
public Entry Get(string key) public Entry Get(string key)
{ {
@ -92,33 +92,33 @@ namespace Grpc.Core
} }
/// <summary> /// <summary>
/// Gets all metadata entries with the specified key. /// Gets the string value of the last metadata entry with the specified key. If there are no matching entries then <c>null</c> is returned.
/// </summary> /// </summary>
public IEnumerable<Entry> GetAll(string key) public string GetValue(string key)
{ {
for (int i = 0; i < entries.Count; i++) return Get(key)?.Value;
{
if (entries[i].Key == key)
{
yield return entries[i];
}
}
} }
/// <summary> /// <summary>
/// Gets the last metadata entry string value with the specified key. If no entries have the key then <c>null</c> is returned. /// Gets the bytes value of the last metadata entry with the specified key. If there are no matching entries then <c>null</c> is returned.
/// </summary> /// </summary>
public string GetValue(string key) public byte[] GetValueBytes(string key)
{ {
return Get(key)?.Value; return Get(key)?.ValueBytes;
} }
/// <summary> /// <summary>
/// Gets the last metadata entry bytes value with the specified key. If no entries have the key then <c>null</c> is returned. /// Gets all metadata entries with the specified key.
/// </summary> /// </summary>
public byte[] GetValueBytes(string key) public IEnumerable<Entry> GetAll(string key)
{ {
return Get(key)?.ValueBytes; for (int i = 0; i < entries.Count; i++)
{
if (entries[i].Key == key)
{
yield return entries[i];
}
}
} }
/// <summary> /// <summary>

Loading…
Cancel
Save