Delen via


HeaderDictionary Class

Definition

Represents a wrapper for RequestHeaders and ResponseHeaders.

public ref class HeaderDictionary : Microsoft::AspNetCore::Http::IHeaderDictionary, System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<System::String ^, Microsoft::Extensions::Primitives::StringValues>>, System::Collections::Generic::IDictionary<System::String ^, Microsoft::Extensions::Primitives::StringValues>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, Microsoft::Extensions::Primitives::StringValues>>
public class HeaderDictionary : Microsoft.AspNetCore.Http.IHeaderDictionary, System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,Microsoft.Extensions.Primitives.StringValues>>, System.Collections.Generic.IDictionary<string,Microsoft.Extensions.Primitives.StringValues>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Microsoft.Extensions.Primitives.StringValues>>
type HeaderDictionary = class
    interface IHeaderDictionary
    interface IDictionary<string, StringValues>
    interface ICollection<KeyValuePair<string, StringValues>>
    interface seq<KeyValuePair<string, StringValues>>
    interface IEnumerable
type HeaderDictionary = class
    interface IHeaderDictionary
    interface ICollection<KeyValuePair<string, StringValues>>
    interface seq<KeyValuePair<string, StringValues>>
    interface IEnumerable
    interface IDictionary<string, StringValues>
Public Class HeaderDictionary
Implements ICollection(Of KeyValuePair(Of String, StringValues)), IDictionary(Of String, StringValues), IEnumerable(Of KeyValuePair(Of String, StringValues)), IHeaderDictionary
Inheritance
HeaderDictionary
Implements

Constructors

HeaderDictionary()

Initializes a new instance of HeaderDictionary.

HeaderDictionary(Dictionary<String,StringValues>)

Initializes a new instance of HeaderDictionary.

HeaderDictionary(Int32)

Initializes a new instance of HeaderDictionary.

Properties

ContentLength

Strongly typed access to the Content-Length header. Implementations must keep this in sync with the string representation.

Count

Gets the number of elements contained in the HeaderDictionary;.

IsReadOnly

Gets a value that indicates whether the HeaderDictionary is in read-only mode.

Item[String]

Get or sets the associated value from the collection as a single string.

Keys

Gets the collection of HTTP header names in this instance.

Values

Gets the collection of HTTP header values in this instance.

Methods

Add(KeyValuePair<String,StringValues>)

Adds a new header item to the collection.

Add(String, StringValues)

Adds the given header and values to the collection.

Clear()

Clears the entire list of objects.

Contains(KeyValuePair<String,StringValues>)

Returns a value indicating whether the specified object occurs within this collection.

ContainsKey(String)

Determines whether the HeaderDictionary contains a specific key.

CopyTo(KeyValuePair<String,StringValues>[], Int32)

Copies the HeaderDictionary elements to a one-dimensional Array instance at the specified index.

GetEnumerator()

Returns an enumerator that iterates through a collection.

Remove(KeyValuePair<String,StringValues>)

Removes the given item from the the collection.

Remove(String)

Removes the given header from the collection.

TryGetValue(String, StringValues)

Retrieves a value from the dictionary.

Explicit Interface Implementations

IDictionary<String,StringValues>.Item[String]

Throws KeyNotFoundException if the key is not present.

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IEnumerable<KeyValuePair<String,StringValues>>.GetEnumerator()

Returns an enumerator that iterates through a collection.

Extension Methods

Append(IHeaderDictionary, String, StringValues)

Add new values. Each item remains a separate array entry.

AppendCommaSeparatedValues(IHeaderDictionary, String, String[])

Quotes any values containing commas, and then comma joins all of the values with any existing values.

GetCommaSeparatedValues(IHeaderDictionary, String)

Get the associated values from the collection separated into individual values. Quoted values will not be split, and the quotes will be removed.

SetCommaSeparatedValues(IHeaderDictionary, String, String[])

Quotes any values containing commas, and then comma joins all of the values.

AppendList<T>(IHeaderDictionary, String, IList<T>)

Appends a sequence of values to IHeaderDictionary.

Applies to