Uri.GetHashCode()方法是重写方法,它返回一个整数值来表示Uri的哈希码。
语法:
int Uri.GetHashCode();
Parameter(s):
此方法不包含任何参数。
返回值:
此方法的返回类型为int,它返回一个Int32(int)值,其中包含为此URI生成的哈希值。
举例说明方法的例子Uri.GetHashCode()
using System;
class UriExample
{
//程序入口
static public void Main()
{
// 创建一个Uri对象
Uri Address;
int hashCode = 0;
Address = new Uri("http://www.nhooo.com");
//获取Uri的哈希码
hashCode = Address.GetHashCode();
Console.WriteLine("Uri Hash Code: {0}",hashCode);
}
}输出结果
Uri Hash Code: 604841720 Press any key to continue . . .