Skip to content

Commit 42ab6f7

Browse files
authored
Update MailAddress.xml with constructor details (#12299)
Clarify behavior of MailAddress constructor regarding displayName and encoding. Fixes dotnet/runtime#57014
1 parent e50d186 commit 42ab6f7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

xml/System.Net.Mail/MailAddress.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ If `displayName` contains non-ASCII characters, the iso-8859-1 character set is
265265
266266
If `address` contains a display name, and `displayName` is not `null` and is not equal to <xref:System.String.Empty?displayProperty=nameWithType>, `displayName` overrides the value specified in `address`.
267267
268+
The <xref:System.Net.Mail.MailAddress.%23ctor(System.String,System.String)> constructor does not check if the `displayName` parameter is valid. This method removes surrounding quotes not displayed by the <xref:System.Net.Mail.MailAddress.DisplayName> property. Quotes will be added before transmission. <xref:System.Text.Encoding.UTF8> encoding will be applied to the <xref:System.Net.Mail.MailAddress.DisplayName> property before transmission.
269+
268270
## Examples
269271
270272
The following code example uses this constructor to create <xref:System.Net.Mail.MailAddress> instances for the sender and recipient of an email message.

0 commit comments

Comments
 (0)