MimeHeaderCollection Class

The header fields of a message or of a MIME part, in their order. The names are compared ignoring case.

Implements

Constructors

NameDescription
MimeHeaderCollection()

MimeHeaderCollection()

MimeHeaderCollection.cs
public MimeHeaderCollection()

No documentation is available.

Properties

NameDescription
CountGets the number of headers.

Gets the number of headers.

public int Count { get; }

Property value

int

Indexers

NameDescription
this[int]Gets a header from its position.
this[string]Gets the decoded value of the first header with a name, or null.

Item overloads

Gets a header from its position.

public MimeHeader this[int index] { get; }
Parameters
index int
The position of the header.
Property value

MimeHeader

Gets the decoded value of the first header with a name, or null.

public string? this[string name] { get; }
Parameters
name string
The name of the header.
Property value

string?

Methods

NameDescription
Add(MimeHeader)Adds a header at the end.
Add(string, string)Adds a header whose value is a text, encoded when it is not ASCII.
Find(string)Returns the first header with a name.
FindAll(string)Returns the headers with a name, in their order.
GetEnumerator()Returns an enumerator that iterates through the collection.
Remove(MimeHeader)Removes a header.
RemoveAll(string)Removes the headers with a name.
Set(string, MimeHeader?)Replaces the headers with a name by one header, at the position of the first one, or removes them when the value is null.
Set(string, string?)Replaces the headers with a name by a text value, or removes them when the value is null.
System.Collections.IEnumerable.GetEnumerator()

Add overloads

Adds a header at the end.

public void Add(MimeHeader header)
Parameters
header MimeHeader
The header.

Add(string, string)

MimeHeaderCollection.cs

Adds a header whose value is a text, encoded when it is not ASCII.

public void Add(string name, string value)
Parameters
name string
The name of the header.
value string
The text.

Returns the first header with a name.

public MimeHeader? Find(string name)

Parameters

name string
The name of the header.

Returns

MimeHeader? The header, or null.

Returns the headers with a name, in their order.

public IEnumerable<MimeHeader> FindAll(string name)

Parameters

name string
The name of the headers.

Returns

IEnumerable<MimeHeader> The headers.

Returns an enumerator that iterates through the collection.

public IEnumerator<MimeHeader> GetEnumerator()

Returns

IEnumerator<MimeHeader> An enumerator that can be used to iterate through the collection.

Remove(MimeHeader)

MimeHeaderCollection.cs

Removes a header.

public bool Remove(MimeHeader header)

Parameters

header MimeHeader
The header.

Returns

bool true when the collection contained the header.

RemoveAll(string)

MimeHeaderCollection.cs

Removes the headers with a name.

public int RemoveAll(string name)

Parameters

name string
The name of the headers.

Returns

int The number of headers removed.

Set overloads

Set(string, MimeHeader?)

MimeHeaderCollection.cs

Replaces the headers with a name by one header, at the position of the first one, or removes them when the value is null.

public void Set(string name, MimeHeader? header)
Parameters
name string
The name of the headers to replace.
header MimeHeader?
The header, or null to remove the headers.

Set(string, string?)

MimeHeaderCollection.cs

Replaces the headers with a name by a text value, or removes them when the value is null.

public void Set(string name, string? value)
Parameters
name string
The name of the header.
value string?
The text, or null.

System.Collections.IEnumerable.GetEnumerator()

MimeHeaderCollection.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.