Прочетете на английски Редактиране

Споделяне чрез


MailAddress.TryCreate Method

Definition

Overloads

TryCreate(String, MailAddress)

Creates a new MailAddress. Does not throw an exception if the object cannot be created.

TryCreate(String, String, MailAddress)

Create a new MailAddress. Does not throw an exception if the object cannot be created.

TryCreate(String, String, Encoding, MailAddress)

Create a new MailAddress. Does not throw an exception if the object cannot be created.

TryCreate(String, MailAddress)

Source:
MailAddress.cs
Source:
MailAddress.cs
Source:
MailAddress.cs

Creates a new MailAddress. Does not throw an exception if the object cannot be created.

C#
public static bool TryCreate(string? address, out System.Net.Mail.MailAddress? result);
C#
public static bool TryCreate(string address, out System.Net.Mail.MailAddress? result);

Parameters

address
String

An email address.

result
MailAddress

When this method returns, contains the email address object if parsing succeeded.

Returns

true if the MailAddress was successfully created; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 5, 6, 7, 8, 9, 10

TryCreate(String, String, MailAddress)

Source:
MailAddress.cs
Source:
MailAddress.cs
Source:
MailAddress.cs

Create a new MailAddress. Does not throw an exception if the object cannot be created.

C#
public static bool TryCreate(string? address, string? displayName, out System.Net.Mail.MailAddress? result);
C#
public static bool TryCreate(string address, string? displayName, out System.Net.Mail.MailAddress? result);

Parameters

address
String

An email address.

displayName
String

The display name associated with the address. This parameter can be null.

result
MailAddress

When this method returns, contains the email address object if parsing succeeded.

Returns

true if the MailAddress was successfully created; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 5, 6, 7, 8, 9, 10

TryCreate(String, String, Encoding, MailAddress)

Source:
MailAddress.cs
Source:
MailAddress.cs
Source:
MailAddress.cs

Create a new MailAddress. Does not throw an exception if the object cannot be created.

C#
public static bool TryCreate(string? address, string? displayName, System.Text.Encoding? displayNameEncoding, out System.Net.Mail.MailAddress? result);
C#
public static bool TryCreate(string address, string? displayName, System.Text.Encoding? displayNameEncoding, out System.Net.Mail.MailAddress? result);

Parameters

address
String

An email address.

displayName
String

The display name associated with address. This parameter can be null.

displayNameEncoding
Encoding

The encoding that defines the character set used for displayName.

result
MailAddress

When this method returns, contains the email address object if parsing succeeded.

Returns

true if the MailAddress was successfully created; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 5, 6, 7, 8, 9, 10