اقرأ باللغة الإنجليزية تحرير

مشاركة عبر


Uri.GetHashCode Method

Definition

Gets the hash code for the URI.

public override int GetHashCode();

Returns

The hash value generated for this URI.

Examples

The following example creates a Uri instance and writes the hash code to the console.

// Create Uri
Uri uriAddress = new Uri("http://www.contoso.com/index.htm#search");
Console.WriteLine(uriAddress.Fragment);
Console.WriteLine("Uri {0} the default port ", uriAddress.IsDefaultPort ? "uses" : "does not use");

Console.WriteLine("The path of this Uri is {0}", uriAddress.GetLeftPart(UriPartial.Path));
Console.WriteLine("Hash code {0}", uriAddress.GetHashCode());
// The example displays output similar to the following:
//        #search
//        Uri uses the default port
//        The path of this Uri is http://www.contoso.com/index.htm
//        Hash code -988419291

Applies to