HeaderCollection Class
Represents a collection of MIME Header elements.
public sealed class HeaderCollection : Collection<Header>, IList<Header>, ICollection<Header>, IList, ICollection, IReadOnlyList<Header>, IReadOnlyCollection<Header>, IEnumerable<Header>, IEnumerable
Public NotInheritable Class HeaderCollection
Inherits Collection(Of Header)
Implements IList(Of Header), ICollection(Of Header), IList, ICollection, IReadOnlyList(Of Header), IReadOnlyCollection(Of Header), IEnumerable(Of Header), IEnumerable
- Inheritance:
- HeaderCollection
Implements
Properties
Item[HeaderId]
Gets the Header with the specified identifier.
public Header this[HeaderId id] { get; }
Public ReadOnly Property Item(id As HeaderId) As Header
Parameters
id
- HeaderId
The identifier.
Property Value
Exceptions
Header with the specified identifier doesn't exist.
Item[String]
Gets the Header with the specified name.
public Header this[string name] { get; }
Public ReadOnly Property Item(name As String) As Header
Parameters
name
- String
The name.
Property Value
Exceptions
Name is null or empty.
Header with the specified name doesn't exist.
Methods
Contains(HeaderId)
Determines whether this HeaderCollection contains Header with specified identifier.
Parameters
id
- HeaderId
The identifier.
Returns
True
if this HeaderCollection contains the Header; otherwise, false
.
IndexOf(HeaderId)
Searches for the Header with specified identifier and returns the zero-based index of the first occurrence within this HeaderCollection.
Parameters
id
- HeaderId
The identifier.
Returns
The zero-based index of the first occurrence of Header within this HeaderCollection, if found; otherwise, –1.
Remove(HeaderId)
Removes the Header with the specified identifier.
Parameters
id
- HeaderId
The identifier.
Returns
True
if item is successfully removed; otherwise, false
.
Remove(String)
Removes the Header with the specified name.
Parameters
name
- String
The name.
Returns
True
if item is successfully removed; otherwise, false
.
TryGetHeader(HeaderId, out Header)
Tries the get a Header with the specified identifier.
public bool TryGetHeader(HeaderId id, out Header value)
Public Function TryGetHeader(id As HeaderId, ByRef value As Header) As Boolean
Parameters
id
- HeaderId
The identifier.
value
- Header
When this method returns, contains the Header with the specified name, if found; otherwise, null.
Returns
True
if this HeaderCollection contains the specified Header; otherwise, false
.
TryGetHeader(String, out Header)
Tries the get a Header with the specified name.
public bool TryGetHeader(string name, out Header value)
Public Function TryGetHeader(name As String, ByRef value As Header) As Boolean
Parameters
name
- String
The name.
value
- Header
When this method returns, contains the Header with the specified name, if found; otherwise, null.
Returns
True
if this HeaderCollection contains the specified Header; otherwise, false
.
Exceptions
Name is null or empty.