c# uri.host
Uri.TryCreate()方法 (Uri.TryCreate() Method)
Uri.TryCreate() method is used to create a new Uri using specified enum UriKind. And here we get new Uri in the specified output parameter.
Uri.TryCreate()方法用于使用指定的枚举UriKind创建新的Uri。 在这里,我们在指定的输出参数中获得了新的Uri。
Syntax:
句法:
bool Uri.TryCreate(string uriString, UriKind kind, out Uri outUri);
Parameter(s):
参数:
string uriString – represents the string to create new Uri.
字符串uriString –表示创建新Uri的字符串。
UriKind kind – represents the UriKind enum to create new Uri.
UriKind类 –表示创建新Uri的UriKind枚举。
out Uri outUri – represents the output variable to create new instance.
out Uri outUri –表示创建新实例的输出变量。
Return value:
返回值:
The return type of this method is boolean, it returns true on successful creation of Uri, otherwise it returns false.
此方法的返回类型是布尔值 ,则返回上成功创建乌里true,否则返回false。
Example to demonstrate example of Uri.TryCreate() method
演示Uri.TryCreate()方法示例的示例
using System;
class UriExample
{
//Entry point of Program
static public void Main()
{
Uri createdUri = null;
Uri.TryCreate("https://www.includehelp.com", UriKind.Absolute, out createdUri);
System.Console.WriteLine("Created Uri: "+createdUri);
}
}
Output
输出量
Created Uri: https://www.includehelp.com/
翻译自: https://www.includehelp.com/dot-net/uri-trycreate-method-with-example.aspx
c# uri.host