Phương thức CharEnumerator.GetHashCode() trong C# trả về mã băm (hash code) cho đối tượng hiện tại.
Cú pháp
public virtual int GetHashCode();
Ví dụ
using System;
public class Demo {
public static void Main() {
string strNum = "john";
CharEnumerator ch = strNum.GetEnumerator();
Console.WriteLine("HashCode = " + ch.GetHashCode());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
ch.Dispose();
}
}
Kết quả
HashCode = 30571253 j o h n