string to hex c# code example
Example 1: hex string to int c#
string hex = "142CBD";
// this returns 1322173
int intValue = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
Example 2: C# int to hex
int num = 123;
//X can be capital and not capital it specifies if the hex characters should be upper or lowercase
//the number specifies the amount of hex characters
//2X will give you something like A5
string hex = num.ToString("X2");
Example 3: hex string to int c#
string prefixedHex = "0x142CBD";
// this works, and returns 1322173
int intValue = Convert.ToInt32(prefixedHex , 16);