Uri.ReferenceEquals()方法与示例

Uri.ReferenceEquals()方法 (Uri.ReferenceEquals() Method)

Uri.ReferenceEquals() Method is used to check the reference of two specified objects. It is a static and override method.

Uri.ReferenceEquals()方法用于检查两个指定对象的引用。 这是一个静态和替代方法。

Syntax:

句法:

    bool Uri.ReferenceEquals (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 reference of two objects are equal otherwise it returns false.

此方法的返回类型为Boolean ,如果两个对象的引用相等,则返回true,否则返回false。

Example to demonstrate example of Uri.ReferenceEquals() Method

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

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/");
                
        if (Uri.ReferenceEquals(uri1, uri1))
            Console.WriteLine("Both references are equal");
        else
            Console.WriteLine("Both references are not equal");

        if (Uri.ReferenceEquals(uri1, uri2))
            Console.WriteLine("Both references are equal");
        else
            Console.WriteLine("Both references are not equal");
    }
}

Output

输出量

Both references are equal
Both references are not equal


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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值