Improve documentation RequestHeaders and ResponseHeaders #3465 (#14971)

This commit is contained in:
Koen Ekelschot 2019-10-16 18:41:28 +02:00 committed by Chris Ross
parent d73dfd3a1d
commit 1599a5a2a7
2 changed files with 33 additions and 1 deletions

View File

@ -279,11 +279,27 @@ namespace Microsoft.AspNetCore.Http.Headers
}
}
/// <summary>
/// Gets the value of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParse method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>The value of the header.</returns>
public T Get<T>(string name)
{
return Headers.Get<T>(name);
}
/// <summary>
/// Gets the values of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParseList method with the signature <code>public static bool TryParseList(IList&lt;string&gt;, out IList&lt;T&gt;)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParseList method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>List of values of the header.</returns>
public IList<T> GetList<T>(string name)
{
return Headers.GetList<T>(name);

View File

@ -158,11 +158,27 @@ namespace Microsoft.AspNetCore.Http.Headers
}
}
/// <summary>
/// Gets the value of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParse method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>The value of the header.</returns>
public T Get<T>(string name)
{
return Headers.Get<T>(name);
}
/// <summary>
/// Gets the values of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParseList method with the signature <code>public static bool TryParseList(IList&lt;string&gt;, out IList&lt;T&gt;)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParseList method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>List of values of the header.</returns>
public IList<T> GetList<T>(string name)
{
return Headers.GetList<T>(name);
@ -208,4 +224,4 @@ namespace Microsoft.AspNetCore.Http.Headers
Headers.AppendList<T>(name, values);
}
}
}
}