System.Net.Mail.MailAddress.ToString Method

Returns a string representation of this instance.

Syntax

public override string ToString ()

Returns

A string that contains the contents of this System.Net.Mail.MailAddress.

Remarks

The string returned by this method is not necessarily identical to the string specified when the instance was created. If the MailAddress.DisplayName property is not null and not equal to string.Empty (""), MailAddress.ToString returns a string composed using the following syntax:

MailAddress.DisplayName <MailAddress.User@MailAddress.Host>

If MailAddress.DisplayName is null or is equal to string.Empty, MailAddress.ToString returns the value of the MailAddress.Address property.

Requirements

Namespace: System.Net.Mail
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0