- 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
Byte.GetHashCode() Method in C#
The Byte.GetHashCode() method in C# is used to return the hash code for the current instance.
Syntax
Following is the syntax −
public override int GetHashCode ();
Example
Let us now see an example to implement the Byte.GetHashCode() method −
using System; public class Demo { public static void Main(){ long val = 5654665; byte[] arr = BitConverter.GetBytes(val); for (int i = 0; i < arr.Length; i++) { int res = arr[i].GetHashCode(); Console.WriteLine("Hashcode = "+res); } } }
Output
This will produce the following output −
Hashcode = 137 Hashcode = 72 Hashcode = 86 Hashcode = 0 Hashcode = 0 Hashcode = 0 Hashcode = 0 Hashcode = 0
Advertisements