- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to Convert Hex String to Hex Number in C#?
Firstly, set the Hex String −
string str = "7D";
Now, use the Convert.ToSByte() method to convert the Hex string to Hex number −
Console.WriteLine(Convert.ToSByte(str, 16));
Let us see the complete code −
Example
using System; namespace Demo { public class Program { public static void Main(string[] args) { string str = "7D"; Console.WriteLine(Convert.ToSByte(str, 16)); } } }
Output
125
Another way of converting Hex String to Hex Number −
Example
using System; namespace Demo { public class Program { public static void Main(string[] args) { string str = "7D"; Console.WriteLine(Convert.ToInt32(str, 16)); } } }
Output
125
- Related Articles
- Convert hex string to number in MySQL?
- How to convert Int to Hex String in Kotlin?
- Convert Integer to Hex String in Java
- Convert an integer to a hex string in C++
- How to convert hex string into int in Python?
- How to convert hex string to byte Array in Java?
- Convert byte Array to Hex String in Java
- Convert Hex String to byte Array in Java
- Python program to convert hex string to decimal
- How to convert a byte array to hex string in Java?
- How to convert a color integer to a hex String in Android?
- How to convert a byte array to a hex string in Java?
- How to convert binary to Hex by using C language?
- 8085 Program to convert ASCII to HEX
- 8085 Program to convert HEX to ASCII

Advertisements