MailboxAddress Class
An email address and its display name, such as "Alice" <alice@example.com> ([RFC 5322] 3.4).
public sealed class MailboxAddress : IEquatable<MailboxAddress>- Implements
Constructors
| Name | Description |
|---|---|
| MailboxAddress(string?, string) | Initializes a new instance of the MailboxAddress class. |
MailboxAddress(string?, string)
MailboxAddress.csInitializes a new instance of the MailboxAddress class.
Properties
| Name | Description |
|---|---|
| Address | Gets the address. |
| Name | Gets the display name, or null. |
Address
MailboxAddress.csMethods
| Name | Description |
|---|---|
| Equals(MailboxAddress?) | Indicates whether the current object is equal to another object of the same type. |
| Equals(object?) | Determines whether the specified object is equal to the current object. |
| FormatList(IEnumerable<MailboxAddress>) | Formats a list of addresses as the value of a header, with the display names encoded when they are not ASCII. |
| GetHashCode() | Serves as the default hash function. |
| Parse(string?) | Parses an address. |
| ParseList(string?) | Parses a list of addresses, such as the value of a To header. The groups are flattened, and invalid entries are skipped. |
| ToHeaderValue() | Returns the address as the value of a header: the display name, encoded when it is not ASCII, and the address. |
| ToString() | Returns the display name and the address. |
Equals overloads
Equals(MailboxAddress?)
MailboxAddress.csIndicates whether the current object is equal to another object of the same type.
public bool Equals(MailboxAddress? other)Parameters
otherMailboxAddress?- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.
Equals(object?)
MailboxAddress.csFormatList(IEnumerable<MailboxAddress>)
MailboxAddress.csFormats a list of addresses as the value of a header, with the display names encoded when they are not ASCII.
public static string FormatList(IEnumerable<MailboxAddress> addresses)GetHashCode()
MailboxAddress.csParse(string?)
MailboxAddress.csParses an address.
public static MailboxAddress? Parse(string? value)Parameters
valuestring?- The value.
Returns
MailboxAddress? The address, or null when the value has none.
ParseList(string?)
MailboxAddress.csParses a list of addresses, such as the value of a To header. The groups are flattened, and invalid entries are skipped.
public static IReadOnlyList<MailboxAddress> ParseList(string? value)Parameters
valuestring?- The value, with its encoded words.
Returns
IReadOnlyList<MailboxAddress> The addresses.