c# uri.host
Uri.Equals()方法 (Uri.Equals() Method)
Uri.Equals() method is an override method that is used to check specified reference with the current object for equality. If both are equal then it returns true otherwise it returns false.
Uri.Equals()方法是一个重写方法,用于检查与当前对象的指定引用是否相等。 如果两者相等,则返回true,否则返回false 。
Syntax:
句法:
bool Uri.Equals(Uri obj);
Parameter(s):
参数:
Uri obj – represents the specified object to checked with current object.
Uri obj –表示要与当前对象检查的指定对象。
Return value:
返回值:
The return type of this method is Boolean, it returns a boolean value if specified object or reference is equal to the current object then it returns true otherwise it returns false.
此方法的返回类型为Boolean ,如果指定的对象或引用等于当前对象,则返回布尔值,然后返回true,否则返回false 。
Example to demonstrate example of Uri.Equals() method
演示Uri.Equals()方法示例的示例
using System;
class UriExample
{
//Entry point of Program
static public void Main()
{
Uri domainUri1;
Uri domainUri2;
Uri domainUri3;
domainUri1 = new Uri("https://www.includehelp.com/index.html");
domainUri2 = new Uri("https://www.includehelp.com/index.html");
domainUri3 = new Uri("https://www.includehelp.com/index_1.html");
if (domainUri1.Equals(domainUri1) == true)
Console.WriteLine("Both are equal");
else
Console.WriteLine("Both are not equal");
if (domainUri1.Equals(domainUri2) == true)
Console.WriteLine("Both are equal");
else
Console.WriteLine("Both are not equal");
if (domainUri1.Equals(domainUri3) == true)
Console.WriteLine("Both are equal");
else
Console.WriteLine("Both are not equal");
}
}
Output
输出量
Both are equal
Both are equal
Both are not equal
翻译自: https://www.includehelp.com/dot-net/uri-equals-method-with-example.aspx
c# uri.host