c# uri.host_C#| Uri.GetLeftPart()方法与示例

c# uri.host

Uri.GetLeftPart()方法 (Uri.GetLeftPart() Method)

Uri.GetLeftPart() method is an instance method that is used to get a specified part from the given URI based on passed UriPartial enum.

Uri.GetLeftPart()方法是一个实例方法,用于基于传递的UriPartial枚举从给定URI中获取指定部分。

Syntax:

句法:

    string Uri.GetLeftPart (UriPartial Part);

Parameter(s):

参数:

  • Part – represents UriPartial to get specified part from Uri.

    零件 –表示从Uri获取指定零件的UriPartial。

Return value:

返回值:

The return type of this method is string, it returns string value to represent specified part of Uri.

该方法的返回类型为string ,它返回表示Uri指定部分的字符串值。

Exception:

例外:

    System.ArgumentException;
    System.InvalidOperationException;

Example to demonstrate example of Uri.GetLeftPart() method

演示Uri.GetLeftPart()方法示例的示例

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create an object of Uri
        Uri Address;

        Address = new Uri("https://www.includehelp.com/index.html#search");

        Console.WriteLine(Address.GetLeftPart(UriPartial.Authority));
        Console.WriteLine(Address.GetLeftPart(UriPartial.Path));
        Console.WriteLine(Address.GetLeftPart(UriPartial.Query));
        Console.WriteLine(Address.GetLeftPart(UriPartial.Scheme));
    }
}

Output

输出量

https://www.includehelp.com
https://www.includehelp.com/index.html
https://www.includehelp.com/index.html
https://


翻译自: https://www.includehelp.com/dot-net/uri-getleftpart-method-with-example.aspx

c# uri.host

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值