Show / Hide Table of Contents

# Class HeaderCollection

The http header collection.

##### Inheritance

Object
HeaderCollection

##### Implements

IEnumerable<HttpHeader>
IEnumerable

##### Inherited Members

Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()

###### Namespace: Titanium.Web.Proxy.Http

###### Assembly: Titanium.Web.Proxy.dll

##### Syntax

    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class HeaderCollection : IEnumerable<HttpHeader>, IEnumerable

### Constructors

| Improve this Doc View Source

#### HeaderCollection()

Initializes a new instance of the HeaderCollection class.

##### Declaration

    public HeaderCollection()

### Properties

| Improve this Doc View Source

#### Headers

Unique Request header collection.

##### Declaration

    public ReadOnlyDictionary<string, HttpHeader> Headers { get; }

##### Property Value

Type | Description
--- | ---
ReadOnlyDictionary<String, HttpHeader> |

| Improve this Doc View Source

#### NonUniqueHeaders

Non Unique headers.

##### Declaration

    public ReadOnlyDictionary<string, List<HttpHeader>> NonUniqueHeaders { get; }

##### Property Value

Type | Description
--- | ---
ReadOnlyDictionary<String, List<HttpHeader>> |

### Methods

| Improve this Doc View Source

#### AddHeader(String, String)

Add a new header with given name and value

##### Declaration

    public void AddHeader(string name, string value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | name |
String | value |

| Improve this Doc View Source

#### AddHeader(HttpHeader)

Adds the given header object to Request

##### Declaration

    public void AddHeader(HttpHeader newHeader)

##### Parameters

Type | Name | Description
--- | --- | ---
HttpHeader | newHeader |

| Improve this Doc View Source

#### AddHeaders(IEnumerable<KeyValuePair<String, String>>)

Adds the given header objects to Request

##### Declaration

    public void AddHeaders(IEnumerable<KeyValuePair<string, string>> newHeaders)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<KeyValuePair<String, String>> | newHeaders |

| Improve this Doc View Source

#### AddHeaders(IEnumerable<KeyValuePair<String, HttpHeader>>)

Adds the given header objects to Request

##### Declaration

    public void AddHeaders(IEnumerable<KeyValuePair<string, HttpHeader>> newHeaders)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<KeyValuePair<String, HttpHeader>> | newHeaders |

| Improve this Doc View Source

#### AddHeaders(IEnumerable<HttpHeader>)

Adds the given header objects to Request

##### Declaration

    public void AddHeaders(IEnumerable<HttpHeader> newHeaders)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<HttpHeader> | newHeaders |

| Improve this Doc View Source

#### Clear()

Removes all the headers.

##### Declaration

    public void Clear()

| Improve this Doc View Source

#### GetAllHeaders()

Returns all headers

##### Declaration

    public List<HttpHeader> GetAllHeaders()

##### Returns

Type | Description
--- | ---
List<HttpHeader> |

| Improve this Doc View Source

#### GetEnumerator()

Returns an enumerator that iterates through the collection.

##### Declaration

    public IEnumerator<HttpHeader> GetEnumerator()

##### Returns

Type | Description
--- | ---
IEnumerator<HttpHeader> | An enumerator that can be used to iterate through the collection.

| Improve this Doc View Source

#### GetFirstHeader(String)

##### Declaration

    public HttpHeader GetFirstHeader(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
String | name |

##### Returns

Type | Description
--- | ---
HttpHeader |

| Improve this Doc View Source

#### GetHeaders(String)

Returns all headers with given name if exists Returns null if doesn't exist

##### Declaration

    public List<HttpHeader> GetHeaders(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
String | name |

##### Returns

Type | Description
--- | ---
List<HttpHeader> |

| Improve this Doc View Source

#### HeaderExists(String)

True if header exists

##### Declaration

    public bool HeaderExists(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
String | name |

##### Returns

Type | Description
--- | ---
Boolean |

| Improve this Doc View Source

#### RemoveHeader(String)

removes all headers with given name

##### Declaration

    public bool RemoveHeader(string headerName)

##### Parameters

Type | Name | Description
--- | --- | ---
String | headerName |

##### Returns

Type | Description
--- | ---
Boolean | True if header was removed False if no header exists with given name

| Improve this Doc View Source

#### RemoveHeader(HttpHeader)

Removes given header object if it exist

##### Declaration

    public bool RemoveHeader(HttpHeader header)

##### Parameters

Type | Name | Description
--- | --- | ---
HttpHeader | header | Returns true if header exists and was removed

##### Returns

Type | Description
--- | ---
Boolean |

### Explicit Interface Implementations

| Improve this Doc View Source

#### IEnumerable.GetEnumerator()

##### Declaration

    IEnumerator IEnumerable.GetEnumerator()

##### Returns

Type | Description
--- | ---
IEnumerator |

### Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable