csharp string to hex

Code Example - csharp string to hex

                
                        byte[] ba = Encoding.Default.GetBytes("sample");
var hexString = BitConverter.ToString(ba);
hexString = hexString.Replace("-", "");
                    
                
 

hex string to int csharp

                        
                                string hex = "142CBD";
// this returns 1322173
int intValue = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
                            
                        
 

Related code examples