Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Net.​Http.​Headers.​HttpHeaders
Assembly: System.Net.Http
Inheritance: object → HttpHeaders
Implemented Interfaces
A collection of headers and their values as defined in RFC 2616.
Properties
public
HttpHeadersNonValidated
NonValidated
Gets a view of the contents of this headers collection that does not parse nor validate the data upon access.
Methods
public
void
Add​(string name,
Collections.​Generic.​IEnumerable<​string> values)
Adds the specified header and its values into the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
name
The header to add to the collection.
values
A list of header values to add to the collection.
public
void
Add​(string name,
string value)
Adds the specified header and its value into the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
name
The header to add to the collection.
value
The content of the header.
public
void
Clear​()
Removes all headers from the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
public
bool
Contains​(string name)
Returns if a specific header exists in the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
Returns <see langword="true" /> if the specified header exists in the collection; otherwise <see langword="false" /> .
name
The specific header.
public
Collections.​Generic.​IEnumerator<​Collections.​Generic.​KeyValuePair<​string, Collections.​Generic.​IEnumerable<​string>>>
GetEnumerator​()
Returns an enumerator that can iterate through the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> instance.
Returns An enumerator for the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> .
public
Collections.​Generic.​IEnumerable<​string>
GetValues​(string name)
Returns all header values for a specified header stored in the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
Returns An array of header strings.
name
The specified header to return values for.
public
bool
Remove​(string name)
Removes the specified header from the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection.
Returns <see langword="true" /> if <paramref name="name" /> is successfully removed; otherwise, <see langword="false" /> . This method also returns <see langword="false" /> if <paramref name="name" /> was not found in the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection or if <paramref name="name" /> is <see langword="null" /> .
name
The name of the header to remove from the collection.
public
string
ToString​()
Returns a string that represents the current <see cref="T:System.Net.Http.Headers.HttpHeaders" /> object.
Returns A string that represents the current object.
public
bool
TryAddWithoutValidation​(string name,
Collections.​Generic.​IEnumerable<​string> values)
Returns a value that indicates whether the specified header and its values were added to the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection without validating the provided information.
Returns <see langword="true" /> if the specified header <paramref name="name" /> and <paramref name="values" /> could be added to the collection; otherwise <see langword="false" /> .
name
The header to add to the collection.
values
The values of the header.
public
bool
TryAddWithoutValidation​(string name,
string value)
Returns a value that indicates whether the specified header and its value were added to the <see cref="T:System.Net.Http.Headers.HttpHeaders" /> collection without validating the provided information.
Returns <see langword="true" /> if the specified header <paramref name="name" /> and <paramref name="value" /> could be added to the collection; otherwise <see langword="false" /> .
name
The header to add to the collection.
value
The content of the header.
public
bool
TryGetValues​(string name,
Collections.​Generic.​IEnumerable`1&? values)
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object