Uri.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(Uri, Uri, Uri) |
Creates a new Uri using the specified base and relative Uri instances. |
TryCreate(Uri, String, Uri) |
Creates a new Uri using the specified base and relative String instances. |
TryCreate(String, UriKind, Uri) |
Creates a new Uri using the specified String instance and a UriKind. |
TryCreate(String, UriCreationOptions, Uri) |
Creates a new Uri using the specified String instance and UriCreationOptions. |
TryCreate(Uri, Uri, Uri)
- Source:
- UriExt.cs
- Source:
- UriExt.cs
- Source:
- UriExt.cs
public:
static bool TryCreate(Uri ^ baseUri, Uri ^ relativeUri, [Runtime::InteropServices::Out] Uri ^ % result);
public static bool TryCreate (Uri baseUri, Uri relativeUri, out Uri result);
public static bool TryCreate (Uri? baseUri, Uri? relativeUri, out Uri? result);
static member TryCreate : Uri * Uri * Uri -> bool
Public Shared Function TryCreate (baseUri As Uri, relativeUri As Uri, ByRef result As Uri) As Boolean
Parameters
- baseUri
- Uri
The base URI.
- result
- Uri
When this method returns, contains a Uri constructed from baseUri
and relativeUri
. This parameter is passed uninitialized.
Returns
true
if the Uri was successfully created; otherwise, false
.
Exceptions
baseUri
is null
.
Remarks
If this method returns true
, the new Uri is in result
.
This method constructs the URI, puts it in canonical form, and validates it. If an unhandled exception occurs, this method catches it. If you want to create a Uri and get exceptions use one of the Uri constructors.
Applies to
TryCreate(Uri, String, Uri)
- Source:
- UriExt.cs
- Source:
- UriExt.cs
- Source:
- UriExt.cs
public:
static bool TryCreate(Uri ^ baseUri, System::String ^ relativeUri, [Runtime::InteropServices::Out] Uri ^ % result);
public static bool TryCreate (Uri baseUri, string relativeUri, out Uri result);
public static bool TryCreate (Uri? baseUri, string? relativeUri, out Uri? result);
static member TryCreate : Uri * string * Uri -> bool
Public Shared Function TryCreate (baseUri As Uri, relativeUri As String, ByRef result As Uri) As Boolean
Parameters
- baseUri
- Uri
The base URI.
- result
- Uri
When this method returns, contains a Uri constructed from baseUri
and relativeUri
. This parameter is passed uninitialized.
Returns
true
if the Uri was successfully created; otherwise, false
.
Remarks
If this method returns true
, the new Uri is in result
.
Applies to
TryCreate(String, UriKind, Uri)
- Source:
- UriExt.cs
- Source:
- UriExt.cs
- Source:
- UriExt.cs
public:
static bool TryCreate(System::String ^ uriString, UriKind uriKind, [Runtime::InteropServices::Out] Uri ^ % result);
public static bool TryCreate (string uriString, UriKind uriKind, out Uri result);
public static bool TryCreate (string? uriString, UriKind uriKind, out Uri? result);
static member TryCreate : string * UriKind * Uri -> bool
Public Shared Function TryCreate (uriString As String, uriKind As UriKind, ByRef result As Uri) As Boolean
Parameters
- uriKind
- UriKind
The type of the Uri.
Returns
true
if the Uri was successfully created; otherwise, false
.
Remarks
If this method returns true
, the new Uri is in result
.
Applies to
TryCreate(String, UriCreationOptions, Uri)
- Source:
- UriExt.cs
- Source:
- UriExt.cs
- Source:
- UriExt.cs
Creates a new Uri using the specified String instance and UriCreationOptions.
public:
static bool TryCreate(System::String ^ uriString, UriCreationOptions % creationOptions, [Runtime::InteropServices::Out] Uri ^ % result);
public static bool TryCreate (string? uriString, in UriCreationOptions creationOptions, out Uri? result);
static member TryCreate : string * UriCreationOptions * Uri -> bool
Public Shared Function TryCreate (uriString As String, ByRef creationOptions As UriCreationOptions, ByRef result As Uri) As Boolean
Parameters
- creationOptions
- UriCreationOptions
Options that control how the Uri is created and behaves.
Returns
true
if the Uri was successfully created; otherwise, false
.