public MailAddress(string address, string displayName, Encoding displayNameEncoding)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
if (address == string.Empty)
{
throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "address" }), "address");
}
this.displayNameEncoding = displayNameEncoding ?? Encoding.GetEncoding("utf-8");
this.displayName = displayName ?? string.Empty;
if ((!string.IsNullOrEmpty(this.displayName) && (this.displayName.Length >= 2)) && ((this.displayName[0] == '"') && (this.displayName[this.displayName.Length - 1] == '"')))
{
this.displayName = this.displayName.Substring(1, this.displayName.Length - 2);
}
MailAddress address2 = MailAddressParser.ParseAddress(address);
this.host = address2.host;
this.userName = address2.userName;
if (string.IsNullOrEmpty(this.displayName))
{
this.displayName = address2.displayName;
}
}