c# uri.host_C#| 具有示例的Uri.Equality()运算符

c# uri.host

Uri.Equality()运算符 (Uri.Equality() Operator)

Uri.Equality() Operator is overloaded which is used to compare two Uri objects. It returns true if two Uri objects contain the same Uri otherwise it returns false.

Uri.Equality()运算符已重载,该运算符用于比较两个Uri对象。 如果两个开放的对象包含相同的URI否则返回false返回true。

Syntax:

句法:

    bool operator == (Uri uri1, Uri uri2);

Parameter(s):

参数:

  • Uri uri1 – represents the first Uri to be compared.

    Uri uri1 –表示要比较的第一个Uri。

  • Uri uri2 – represents the second Uri to be compared.

    Uri uri2 –表示要比较的第二个Uri。

Return value:

返回值:

The return type of this method is Boolean, it returns true if the Uri instances are the same; otherwise, false.

此方法的返回类型为Boolean ,如果Uri实例相同,则返回true;否则,返回true 。 否则为false

Example to demonstrate example of Uri.Equality() Operator

演示Uri.Equality()运算符示例的示例

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create some Uri objects
        Uri uri1 = new Uri("https://www.includehelp.com/");
        Uri uri2 = new Uri("https://www.includehelp.com/");
        Uri uri3 = new Uri("https://www.includehelp.com/index.html");

        if (uri1 == uri2)
            Console.WriteLine("uri1 and uri2 are equal");
        else
            Console.WriteLine("uri1 and uri2 are not equal");

        if (uri1 == uri3)
            Console.WriteLine("uri1 and uri3 are equal");
        else
            Console.WriteLine("uri1 and uri3 are not equal");
    }
}

Output

输出量

uri1 and uri2 are equal
uri1 and uri3 are not equal

Reference: Uri.Equality(Uri, Uri) Operator

参考: Uri.Equality(Uri,Uri)运算符

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

c# uri.host

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值