CompilerInfo.GetHashCode 方法

定義

傳回目前實例的哈希碼。

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

傳回

目前實例的 32 位元有號整數雜湊碼 CompilerInfo ,適用於雜湊演算法及資料結構(如雜湊表)。

範例

以下程式碼範例建立該 Microsoft.VisualBasic.VBCodeProvider 類別的實例。 範例顯示新提供者實例的提供者名稱、雜湊碼及預設檔名副檔名。 此程式碼範例是本類別更大範例 CompilerInfo 的一部分。

// 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)

備註

此方法會覆蓋該方法。Object.GetHashCode

此方法為兩個相等 Equals 的物件產生相同的雜湊碼。

適用於

另請參閱