UTF8Encoding.GetHashCode Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Returns the hash code for the current instance.
Assembly: mscorlib (in mscorlib.dll)
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.
Imports System.Text Class Example Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) ' Many ways to instantiate a UTF8 encoding. Dim UTF8a As New UTF8Encoding() Dim UTF8b As Encoding = Encoding.UTF8 Dim UTF8c = New UTF8Encoding(True, True) Dim UTF8d = New UTF8Encoding(False, False) ' But not all are the same. outputBlock.Text &= UTF8a.GetHashCode() & vbCrLf outputBlock.Text &= UTF8b.GetHashCode() & vbCrLf outputBlock.Text &= UTF8c.GetHashCode() & vbCrLf outputBlock.Text &= UTF8d.GetHashCode() & vbCrLf End Sub 'Main End Class 'UTF8EncodingExample
Show: