

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Char.GetHashCode() Method with Examples in C#
<p>The Char.GetHashCode() method in C# is used to return the hash code for the current instance.</p><h2>Syntax</h2><p>Following is the syntax −</p><pre class="result notranslate">public override int GetHashCode ();</pre><h2>Example</h2><p>Let us now see an example to implement the Char.GetHashCode() method −</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">using System; public class Demo { public static void Main(){ char val = 'H'; bool res; Console.WriteLine("Hashcode for val = "+val.GetHashCode()); res = val.Equals('d'); Console.WriteLine("Return Value = "+res); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">Hashcode for val = 4718664 Return Value = False</pre><h2>Example</h2><p>Let us now see another example −</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">using System; public class Demo { public static void Main(){ char val = 'm'; bool res; Console.WriteLine("Hashcode for val = "+val.GetHashCode()); res = val.Equals('m'); Console.WriteLine("Return Value = "+res); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">Hashcode for val = 7143533 Return Value = True</pre>
- Related Questions & Answers
- Int64.GetHashCode Method in C# with Examples
- UInt32.GetHashCode() Method in C# with Examples
- UInt16.GetHashCode() Method in C# with Examples
- UInt64.GetHashCode() Method in C# with Examples
- Int16.GetHashCode() Method in C# with Examples
- Int32.GetHashCode Method in C# with Examples
- C# Object.GetType() Method with Examples
- C# Queue.TrimExcess() Method with Examples
- C# Stack.TrimExcess() Method with Examples
- C# Object.GetHashCode() Method with Examples
- Java toDegrees() method with Examples
- jQuery not() method with Examples
- JavaScript removeEventListener() method with examples
- Java signum() method with Examples
- Java lang.Long.toBinaryString() method with Examples
- Java cbrt() method with Examples
Advertisements