websocket-sharp : WebSocketSharp.Net Namespace

WebHeaderCollection Class

Provides a collection of the HTTP headers associated with a request or response.

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public class WebHeaderCollection : System.Collections.Specialized.NameValueCollection, System.Runtime.Serialization.ISerializable

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Members

See Also: Inherited members from System.Collections.Specialized.NameValueCollection.

Public Constructors

Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class.

Protected Constructors

Public Properties

[read-only]
override
AllKeys string[]. Gets all header names in the collection.
[read-only]
override
Count int . Gets the number of headers in the collection.
default property
Item (System.Net.HttpRequestHeader) string . Gets or sets the specified request header in the collection.
default property
Item (System.Net.HttpResponseHeader) string . Gets or sets the specified response header in the collection.
[read-only]
override
Keys System.Collections.Specialized.NameObjectCollectionBase.KeysCollection . Gets a collection of header names in the collection.

Public Methods

Add (string)
Adds the specified header to the collection.
Add (System.Net.HttpRequestHeader, string)
Adds the specified request header with the specified value to the collection.
Add (System.Net.HttpResponseHeader, string)
Adds the specified response header with the specified value to the collection.
override
Add (string, string)
Adds a header with the specified name and value to the collection.
override
Clear ()
Removes all headers from the collection.
override
Get (int) : string
Get the value of the header with the specified index in the collection.
override
Get (string) : string
Get the value of the header with the specified name in the collection.
override
GetEnumerator () : IEnumerator
Gets the enumerator to use to iterate through the WebSocketSharp.Net.WebHeaderCollection.
override
GetKey (int) : string
Get the header name at the specified index position in the collection.
override
GetObjectData (System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Populates the specified System.Runtime.Serialization.SerializationInfo with the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.
override
GetValues (int) : string[]
Gets an array of header values stored in the specified index position of the header collection.
override
GetValues (string) : string[]
Gets an array of header values stored in the specified header name.
static
IsRestricted (string) : bool
Determines whether the specified header can be set for the request.
static
IsRestricted (string, bool) : bool
Determines whether the specified header can be set for the request or the response.
override
OnDeserialization (object)
Implements the System.Runtime.Serialization.ISerializable interface and raises the deserialization event when the deserialization is complete.
Remove (System.Net.HttpRequestHeader)
Removes the specified header from the collection.
Remove (System.Net.HttpResponseHeader)
Removes the specified header from the collection.
override
Remove (string)
Removes the specified header from the collection.
Set (System.Net.HttpRequestHeader, string)
Sets the specified header to the specified value.
Set (System.Net.HttpResponseHeader, string)
Sets the specified header to the specified value.
override
Set (string, string)
Sets the specified header to the specified value.
ToByteArray () : byte[]
Converts the current WebSocketSharp.Net.WebHeaderCollection to an array of byte.
override
ToString () : string
Returns a string that represents the current WebSocketSharp.Net.WebHeaderCollection.

Protected Methods

AddWithoutValidate (string, string)
Adds a header to the collection without checking whether the header is on the restricted header list.

Explicitly Implemented Interface Members

Extension Methods

static
Exists (this System.Collections.Specialized.NameValueCollection, string) : bool
Determines whether the entry with the specified key exists in the specified System.Collections.Specialized.NameValueCollection.
static
Exists (this System.Collections.Specialized.NameValueCollection, string, string) : bool
Determines whether the entry with the specified both key and value exists in the specified System.Collections.Specialized.NameValueCollection.
static
IsNull<T> (this T) : bool
Determines whether the specified object is null.
static
IsNullDo<T> (this T, Action) : bool
Determines whether the specified object is null. And invokes the specified Action delegate if the specified object is null.

Member Details

WebHeaderCollection Constructor

Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class.

Syntax

public WebHeaderCollection ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

WebHeaderCollection Constructor

Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class with the specified System.Runtime.Serialization.SerializationInfo and System.Runtime.Serialization.StreamingContext.

Syntax

protected WebHeaderCollection (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)

Parameters

serializationInfo
A System.Runtime.Serialization.SerializationInfo that contains the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.
streamingContext
A System.Runtime.Serialization.StreamingContext that contains the source of the serialized stream associated with the new WebSocketSharp.Net.WebHeaderCollection.

Exceptions

Type Reason
ArgumentNullException serializationInfo is null.
ArgumentException An element with the specified name is not found in serializationInfo.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Add Method

Adds the specified header to the collection.

Syntax

public void Add (string header)

Parameters

header
A string that contains a header with the name and value separated by a colon (:).

Exceptions

Type Reason
ArgumentNullException header is null, string.Empty, or the name part of header is string.Empty.
ArgumentException

header does not contain a colon.

-or-

header is a restricted header.

-or-

The name or value part of header contains invalid characters.

ArgumentOutOfRangeException The length of the value part of header is greater than 65535.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow the header.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Add Method

Adds the specified request header with the specified value to the collection.

Syntax

public void Add (System.Net.HttpRequestHeader header, string value)

Parameters

header
A System.Net.HttpRequestHeader is a request header to add.
value
A string that contains the value of the header to add.

Exceptions

Type Reason
ArgumentOutOfRangeException The length of value is greater than 65535.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpRequestHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Add Method

Adds the specified response header with the specified value to the collection.

Syntax

public void Add (System.Net.HttpResponseHeader header, string value)

Parameters

header
A System.Net.HttpResponseHeader is a response header to add.
value
A string that contains the value of the header to add.

Exceptions

Type Reason
ArgumentOutOfRangeException The length of value is greater than 65535.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpResponseHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Add Method

Adds a header with the specified name and value to the collection.

Syntax

public override void Add (string name, string value)

Parameters

name
A string that contains the name of the header to add.
value
A string that contains the value of the header to add.

Exceptions

Type Reason
ArgumentException

name or value contains invalid characters.

-or-

name is a restricted header name.

ArgumentOutOfRangeException The length of value is greater than 65535.
ArgumentNullException name is null or string.Empty.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow the header name.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

AddWithoutValidate Method

Adds a header to the collection without checking whether the header is on the restricted header list.

Syntax

protected void AddWithoutValidate (string headerName, string headerValue)

Parameters

headerName
A string that contains the name of the header to add.
headerValue
A string that contains the value of the header to add.

Exceptions

Type Reason
ArgumentException headerName or headerValue contains invalid characters.
ArgumentNullException headerName is null or string.Empty.
ArgumentOutOfRangeException The length of headerValue is greater than 65535.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow the headerName.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

AllKeys Property

Gets all header names in the collection.

Syntax

public override string[] AllKeys { get; }

Value

An array of string that contains all header names in the collection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Clear Method

Removes all headers from the collection.

Syntax

public override void Clear ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Count Property

Gets the number of headers in the collection.

Syntax

public override int Count { get; }

Value

An int that indicates the number of headers in the collection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Get Method

Get the value of the header with the specified index in the collection.

Syntax

public override string Get (int index)

Parameters

index
An int that is the zero-based index of the header to get.

Returns

A string that receives the value of the header.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Get Method

Get the value of the header with the specified name in the collection.

Syntax

public override string Get (string name)

Parameters

name
A string that contains the name of the header to get.

Returns

A string that receives the value of the header. null if there is no header with name in the collection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

GetEnumerator Method

Gets the enumerator to use to iterate through the WebSocketSharp.Net.WebHeaderCollection.

Syntax

public override IEnumerator GetEnumerator ()

Returns

An instance of an implementation of the IEnumerator interface to use to iterate through the WebSocketSharp.Net.WebHeaderCollection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

GetKey Method

Get the header name at the specified index position in the collection.

Syntax

public override string GetKey (int index)

Parameters

index
An int is the zero-based index of the key to get from the collection.

Returns

A string that receives the header name.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

GetObjectData Method

Populates the specified System.Runtime.Serialization.SerializationInfo with the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.

Syntax

public override void GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)

Parameters

serializationInfo
A System.Runtime.Serialization.SerializationInfo that holds the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.
streamingContext
A System.Runtime.Serialization.StreamingContext that specifies the destination for the serialization.

Exceptions

Type Reason
ArgumentNullException serializationInfo is null.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

GetValues Method

Gets an array of header values stored in the specified index position of the header collection.

Syntax

public override string[] GetValues (int index)

Parameters

index
An int is the zero-based index of the header in the collection.

Returns

An array of string that receives the header values.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

GetValues Method

Gets an array of header values stored in the specified header name.

Syntax

public override string[] GetValues (string header)

Parameters

header
A string that contains a header name.

Returns

An array of string that receives the header values.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

IsRestricted Method

Determines whether the specified header can be set for the request.

Syntax

public static bool IsRestricted (string headerName)

Parameters

headerName
A string that contains the name of the header to test.

Returns

true if the header is restricted; otherwise, false.

Exceptions

Type Reason
ArgumentNullException headerName is null or string.Empty.
ArgumentException headerName contains invalid characters.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

IsRestricted Method

Determines whether the specified header can be set for the request or the response.

Syntax

public static bool IsRestricted (string headerName, bool response)

Parameters

headerName
A string that contains the name of the header to test.
response
true if does the test for the response; for the request, false.

Returns

true if the header is restricted; otherwise, false.

Exceptions

Type Reason
ArgumentNullException headerName is null or string.Empty.
ArgumentException headerName contains invalid characters.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Item Property

Gets or sets the specified request header in the collection.

Syntax

This is the default property for this class.

public string this [System.Net.HttpRequestHeader header] { get; set; }

Parameters

header
A System.Net.HttpRequestHeader that indicates a request header.

Value

A string that contains the value of the specified request header.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpRequestHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

ArgumentOutOfRangeException The length of value is greater than 65535.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Item Property

Gets or sets the specified response header in the collection.

Syntax

This is the default property for this class.

public string this [System.Net.HttpResponseHeader header] { get; set; }

Parameters

header
A System.Net.HttpResponseHeader that indicates a response header.

Value

A string that contains the value of the specified response header.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpResponseHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

ArgumentOutOfRangeException The length of value is greater than 65535.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Keys Property

Gets a collection of header names in the collection.

Syntax

Value

A System.Collections.Specialized.NameObjectCollectionBase.KeysCollection that contains a collection of header names in the collection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

OnDeserialization Method

Implements the System.Runtime.Serialization.ISerializable interface and raises the deserialization event when the deserialization is complete.

Syntax

public override void OnDeserialization (object sender)

Parameters

sender
An object that contains the source of the deserialization event.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Remove Method

Removes the specified header from the collection.

Syntax

public void Remove (System.Net.HttpRequestHeader header)

Parameters

header
A System.Net.HttpRequestHeader to remove from the collection.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpRequestHeader values.
ArgumentException header is a restricted header.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Remove Method

Removes the specified header from the collection.

Syntax

public void Remove (System.Net.HttpResponseHeader header)

Parameters

header
A System.Net.HttpResponseHeader to remove from the collection.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpResponseHeader values.
ArgumentException header is a restricted header.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Remove Method

Removes the specified header from the collection.

Syntax

public override void Remove (string name)

Parameters

name
A string that contains the name of the header to remove from the collection.

Exceptions

Type Reason
ArgumentNullException name is null or string.Empty.
ArgumentException

name contains invalid characters.

-or-

name is a restricted header name.

InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow the header name.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Set Method

Sets the specified header to the specified value.

Syntax

public void Set (System.Net.HttpRequestHeader header, string value)

Parameters

header
A System.Net.HttpRequestHeader to set.
value
A string that contains the value of the header to set.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpRequestHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

ArgumentOutOfRangeException The length of value is greater than 65535.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Set Method

Sets the specified header to the specified value.

Syntax

public void Set (System.Net.HttpResponseHeader header, string value)

Parameters

header
A System.Net.HttpResponseHeader to set.
value
A string that contains the value of the header to set.

Exceptions

Type Reason
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow any of System.Net.HttpResponseHeader values.
ArgumentException

header is a restricted header.

-or-

value contains invalid characters.

ArgumentOutOfRangeException The length of value is greater than 65535.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

Set Method

Sets the specified header to the specified value.

Syntax

public override void Set (string name, string value)

Parameters

name
A string that contains the name of the header to set.
value
A string that contains the value of the header to set.

Exceptions

Type Reason
ArgumentNullException name is null or string.Empty.
ArgumentException

name or value contain invalid characters.

-or-

name is a restricted header name.

ArgumentOutOfRangeException The length of value is greater than 65535.
InvalidOperationException The current WebSocketSharp.Net.WebHeaderCollection instance does not allow the header name.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

System.Runtime.Serialization.ISerializable.GetObjectData Method

Populates the specified System.Runtime.Serialization.SerializationInfo with the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.

Syntax

void System.Runtime.Serialization.ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)

Parameters

serializationInfo
A System.Runtime.Serialization.SerializationInfo that holds the data to need to serialize the WebSocketSharp.Net.WebHeaderCollection object.
streamingContext
A System.Runtime.Serialization.StreamingContext that specifies the destination for the serialization.

Exceptions

Type Reason
ArgumentNullException serializationInfo is null.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

ToByteArray Method

Converts the current WebSocketSharp.Net.WebHeaderCollection to an array of byte.

Syntax

public byte[] ToByteArray ()

Returns

An array of byte that receives the converted current WebSocketSharp.Net.WebHeaderCollection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

ToString Method

Returns a string that represents the current WebSocketSharp.Net.WebHeaderCollection.

Syntax

public override string ToString ()

Returns

A string that represents the current WebSocketSharp.Net.WebHeaderCollection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)