C#Socket發16進制以及進制轉換


string  input =  "Hello World!" ;
char [] values = input.ToCharArray();
foreach  ( char  letter  in  values)
{
     // Get the integral value of the character.
     int  value = Convert.ToInt32(letter);
     // Convert the decimal value to a hexadecimal value in string form.
     string  hexOutput = String.Format( "{0:X}" , value);
     Console.WriteLine( "Hexadecimal value of {0} is {1}" , letter, hexOutput);

以上為字符轉為16進制; 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM