共用方式為


GacMembershipCondition.GetHashCode 方法

定義

取得目前成員資格條件的雜湊程式碼。

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

傳回

Int32

0 (零)。

範例

下列程式碼範例示範 如何使用 GetHashCode 方法。 這個範例是提供給 類別之較大範例的 GacMembershipCondition 一部分。

GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition;
try
{
    Console::WriteLine(
        "Result of GetHashCode for a GacMembershipCondition = {0}\n",
        Gac1->GetHashCode());
}
catch (Exception^ e) 
{
     Console::WriteLine("GetHashCode failed : {0}{1}", Gac1, e);
     return false;
}
GacMembershipCondition Gac1 = new GacMembershipCondition();
try
{
    Console.WriteLine(
        "Result of GetHashCode for a GacMembershipCondition = " + 
        Gac1.GetHashCode().ToString() + "\n");
}
catch (Exception e)
{
    Console.WriteLine("GetHashCode failed : " + Gac1.ToString() + e);
    return false;
}
Dim Gac1 As New GacMembershipCondition
Try
    Console.WriteLine( _
        ("Result of GetHashCode for a GacMembershipCondition = " _
        & Gac1.GetHashCode().ToString() & ControlChars.Lf))
Catch e As Exception
    Console.WriteLine(("GetHashCode failed : " & _
        Gac1.ToString() & e.ToString()))
    Return False
End Try

備註

方法 GetHashCode 會傳回 0 (零) ,因為 GacMembershipCondition 物件沒有屬性可以區分彼此。

適用於