- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
UInt16.GetHashCode() Method in C# with Examples
The UInt16.GetHashCode() method in C# is used to get the HashCode for the current UInt16 instance.
Syntax
Following is the syntax −
public override int GetHashCode ();
Example
Let us now see an example to implement the UInt16.GetHashCode() method −
using System; public class Demo { public static void Main(){ ushort val1 = 100; ushort val2 = UInt16.MinValue; Console.WriteLine("HashCode for val1 = "+val1.GetHashCode()); Console.WriteLine("HashCode for val2 = "+val2.GetHashCode()); } }
Output
This will produce the following output −
HashCode for val1 = 100 HashCode for val2 = 0
Example
Let us now see another example to implement the UInt16.GetHashCode() method −
using System; public class Demo { public static void Main(){ ushort val1 = 50; ushort val2 = UInt16.MaxValue; Console.WriteLine("HashCode for val1 = "+val1.GetHashCode()); Console.WriteLine("HashCode for val2 = "+val2.GetHashCode()); } }
Output
This will produce the following output −
HashCode for val1 = 50 HashCode for val2 = 65535
Advertisements