Evidence.GetHashCode 方法


获取 Evidence 对象的哈希代码,此代码适合在哈希算法和数据结构(例如哈希表)中使用。Gets a hash code for the Evidence object that is suitable for use in hashing algorithms and data structures such as a hash table.

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


当前 Evidence 对象的哈希代码。A hash code for the current Evidence object.



下面的代码示例演示如何使用 GetHashCode 方法。The following code example shows the use of the GetHashCode method. 此示例是为 Evidence 类提供的更大示例的一部分。This example is part of a larger example provided for the Evidence class.

Console.WriteLine(ControlChars.Lf & "Get the hashcode for the evidence.")
Console.WriteLine(("HashCode = " & myEvidence.GetHashCode().ToString()))
Console.WriteLine("\nGet the hashcode for the evidence.");
Console.WriteLine("HashCode = " + myEvidence.GetHashCode().ToString());
Console::WriteLine( "\nGet the hashcode for the evidence." );
Console::WriteLine( "HashCode = {0}", myEvidence->GetHashCode() );


同一证据的两个实例的哈希代码可能不同,因此,哈希代码不应用于比较两个 @no__t 0 个对象。The hash code for two instances of the same evidence might be different, Therefore, hash codes should not be used to compare two Evidence objects.