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