แก้ไข

แชร์ผ่าน


CompilerInfo.GetHashCode Method

Definition

Returns the hash code for the current instance.

public:
 override int GetHashCode();
public override int GetHashCode ();
override this.GetHashCode : unit -> int
Public Overrides Function GetHashCode () As Integer

Returns

A 32-bit signed integer hash code for the current CompilerInfo instance, suitable for use in hashing algorithms and data structures such as a hash table.

Examples

The following code example creates an instance of the Microsoft.VisualBasic.VBCodeProvider class. The example displays the provider name, hash code, and default file name extension for the new provider instance. This code example is part of a larger example provided for the CompilerInfo class.

         // Get the provider for Microsoft.VisualBasic
//         CodeDomProvider^ provider = CodeDomProvider.CreateProvider("VisualBasic");
         CodeDomProvider^ provider = CodeDomProvider::CreateProvider("VisualBasic");
         if ( provider ) // Display the Visual Basic language provider information.
         {
            Console::WriteLine( "Visual Basic provider is {0}", provider->ToString() );
            Console::WriteLine( "  Provider hash code:     {0}", provider->GetHashCode().ToString() );
            Console::WriteLine( "  Default file extension: {0}", provider->FileExtension );
         }
// Get the provider for Microsoft.VisualBasic
CodeDomProvider provider = CodeDomProvider.CreateProvider("VisualBasic");

// Display the Visual Basic language provider information.
Console.WriteLine("Visual Basic provider is {0}",
    provider.ToString());
Console.WriteLine("  Provider hash code:     {0}",
    provider.GetHashCode().ToString());
Console.WriteLine("  Default file extension: {0}",
    provider.FileExtension);
' Get the provider for Microsoft.VisualBasic
   Dim provider = CodeDomProvider.CreateProvider("VisualBasic")

' Display the Visual Basic language provider information.
Console.WriteLine("Visual Basic provider is {0}", _
   provider.ToString())
Console.WriteLine("  Provider hash code:     {0}", _
   provider.GetHashCode().ToString())
Console.WriteLine("  Default file extension: {0}", _
   provider.FileExtension)

Remarks

This method overrides the Object.GetHashCode method.

This method generates the same hash code for two objects that are equal according to the Equals method.

Applies to

See also