UTF8Encoding: GetHashCode

GetHashCode

Returns the hash code for the current instance.



 Public Function GetHashCode ( ) As Long

Return Values

Long -  The hash code for the current instance.

Examples

The following example demonstrates how to use the GetHashCode method to return a hash code for an instance of UTF8Encoding. Notice that the hash code returned by this method varies depending on the constructor used to create the UTF8Encoding.

Public Sub Main()
    Dim UTF8A As UTF8Encoding
    Dim UTF8B As UTF8Encoding
    Dim UTF8C As UTF8Encoding
    Dim UTF8D As UTF8Encoding
    
    ' Many ways to instantiate a UTF8 encoding.
    Set UTF8A = New UTF8Encoding
    Set UTF8B = NewUTF8Encoding(True)
    Set UTF8C = NewUTF8Encoding(True, True)
    Set UTF8D = NewUTF8Encoding(False, True)
    
    ' But not all are the same.
    Console.WriteLine UTF8A.GetHashCode
    Console.WriteLine UTF8B.GetHashCode
    Console.WriteLine UTF8C.GetHashCode
    Console.WriteLine UTF8C.GetHashCode
    
    Console.ReadKey
End Sub

See Also

Project CorLib Overview

Class UTF8Encoding Overview