MailAddress.TryCreate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public:
static bool TryCreate(System::String ^ address, [Runtime::InteropServices::Out] System::Net::Mail::MailAddress ^ % result);
public static bool TryCreate (string address, out System.Net.Mail.MailAddress? result);
public static bool TryCreate (string? address, out System.Net.Mail.MailAddress? result);
static member TryCreate : string * MailAddress -> bool
Public Shared Function TryCreate (address As String, ByRef result As MailAddress) As Boolean
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
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.
public:
static bool TryCreate(System::String ^ address, System::String ^ displayName, [Runtime::InteropServices::Out] System::Net::Mail::MailAddress ^ % result);
public static bool TryCreate (string address, string? displayName, out System.Net.Mail.MailAddress? result);
public static bool TryCreate (string? address, string? displayName, out System.Net.Mail.MailAddress? result);
static member TryCreate : string * string * MailAddress -> bool
Public Shared Function TryCreate (address As String, displayName As String, ByRef result As MailAddress) As Boolean
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
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.
public:
static bool TryCreate(System::String ^ address, System::String ^ displayName, System::Text::Encoding ^ displayNameEncoding, [Runtime::InteropServices::Out] System::Net::Mail::MailAddress ^ % result);
public static bool TryCreate (string address, string? displayName, System.Text.Encoding? displayNameEncoding, out System.Net.Mail.MailAddress? result);
public static bool TryCreate (string? address, string? displayName, System.Text.Encoding? displayNameEncoding, out System.Net.Mail.MailAddress? result);
static member TryCreate : string * string * System.Text.Encoding * MailAddress -> bool
Public Shared Function TryCreate (address As String, displayName As String, displayNameEncoding As Encoding, ByRef result As MailAddress) As Boolean
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
.