Http​Headers.​Add Method

Definition

Overloads

Add(​String, ​IEnumerable<​String>)

Adds the specified header and its values into the HttpHeaders collection.

Add(​String, ​String)

Adds the specified header and its value into the HttpHeaders collection.

Add(String, IEnumerable<String>)

Adds the specified header and its values into the HttpHeaders collection.

public void Add (string name, System.Collections.Generic.IEnumerable<string> values);
Parameters
name
String

The header to add to the collection.

values
IEnumerable<String>

A list of header values to add to the collection.

Remarks

The header values will be parsed and validated.

If the specified header does not exist, the Add method inserts a new header into the list of header name/value pairs.

If the specified header is already present, values are added to the comma-separated list of values associated with the header.

Add(String, String)

Adds the specified header and its value into the HttpHeaders collection.

public void Add (string name, string value);
Parameters
name
String

The header to add to the collection.

value
String

The content of the header.

Remarks

The header value will be parsed and validated.

If the specified header does not exist, the Add method inserts a new header into the list of header name/value pairs.

If the specified header is already present, value is added to the comma-separated list of values associated with the header.