c# uri.host_C#| 具有示例的Uri.TryCreate()方法

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值