// int turn hexadecimal (long same type) int A = 90 ; String STR Convert.ToString = (A, 16 ); // . 5A // int binary transfected int A = 90 ; String STR = Convert.ToString (A, 2 ); // 1011010 // int transfer byte int A = 90 ; String STR = Convert.Tobyte (A); // 0x5A // 16 hexadecimal switch 10 String hex = " . 5A " ; String AA = the Convert .ToInt32 (hex, 16) .ToString (); // 90 // 16 transfer binary hexadecimal String hex = " . 5A " ; String AA = Convert.ToString (Convert.ToInt32 (hex, 16 ), 2 ); // 1011010 // ten hex decimal string transfected public string ConvertHexToIntStr ( string hexstr) { IF (hexstr.StartsWith ( " 0x " )) { hexstr = hexstr.Substring ( 2 ); } //If it is not a valid string or a hexadecimal character string length is greater than 16 or is empty, both return NULL IF (IsHexadecimal (hexstr) || hexstr.Length>! 16 || String .IsNullOrEmpty (hexstr)) { return null ; } IF (hexstr.Length> . 8 ) { return Convert.ToInt64 (hexstr, 16 ) .ToString (); } the else IF (hexstr.Length> . 4 ) { return Convert.ToInt32 (hexstr, 16 ) .ToString (); } the else { returnConvert.ToInt16 (hexstr, 16 ) .ToString (); } } // determines whether the hexadecimal string public BOOL IsHexadecimal ( String STR) { const String the PATTERN = @ " [A-Fa of the-f0-9] $ + " ; return System.Text.RegularExpressions.Regex.IsMatch (STR, the PATTERN); }