C# में CharEnumerator.GetHashCode() विधि वर्तमान ऑब्जेक्ट के लिए हैश कोड देता है।
सिंटैक्स
public virtual int GetHashCode ();
आइए अब हम CharEnumerator.GetHashCode() पद्धति को लागू करने के लिए एक उदाहरण देखें -
उदाहरण
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 + " ");
// disposed
ch.Dispose();
// this will show an error since we disposed the object above
// Console.WriteLine(ch.Current);
}
} आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा -
HashCode = 30571253 j o h n