- 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
Represent Int64 as a Hexadecimal String in C#
To represent Int64 as a Binary string in C#, use the ToString() method and set the base as the ToString() method’s second parameter i.e.16 for Hexadecimal.
Int64 represents a 64-bit signed integer.
Firstly, set an Int64 variable.
long val = 947645;
Now, convert it to a hex string by including 16 as the second parameter.
Convert.ToString(val, 16)
Example
using System; class Demo { static void Main() { long val = 947645; Console.WriteLine("Long: "+val); Console.Write("Hex String: "+Convert.ToString(val, 16)); } }
Output
Long: 947645 Hex String: e75bd
Advertisements
To Continue Learning Please Login
Login with Google