Export (0) Print
Expand All

UnicodeEncoding.GetHashCode Method

Returns the hash code for the current instance.

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

public override int GetHashCode()

Return Value

Type: System.Int32
The hash code for the current UnicodeEncoding object.

The following code example demonstrates how to use the GetHashCode method to return a hash code for a UnicodeEncoding object. Regardless of how the UnicodeEncoding object is created, all objects return the same hash code.


using System;
using System.Text;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      UnicodeEncoding unicode1 = new UnicodeEncoding();
      Encoding unicode2 = Encoding.Unicode;

      outputBlock.Text += unicode1.GetHashCode() + "\n";
      outputBlock.Text += unicode2.GetHashCode() + "\n";

   }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft