C # conversion between binary decimal hex

int A = 10 ; 
Console.WriteLine (a.ToString ( " X- " ));                    // 10 hex 16 hex turn 
Console.WriteLine (Convert.ToString (A, 16 ));      // 10 decimal transfected into 16 system 
Console.WriteLine (Convert.ToString (A, 2 ));        // 10 transfer binary decimal 

String B = " 1010 " ; 
Console.WriteLine (Convert.ToInt32 (B, 2 ));        // binary turn decimal 
Console.WriteLine ( String .Format ( " {0: X-} " , Convert.ToInt32 (B, 2))); // binary hexadecimal transfected 

int C = 0x0A ; 
Console.WriteLine (Convert.ToString (c, 2 ));       // hexadecimal binary switch 
Console.WriteLine (Convert.ToString (c , 10 ));      // hexadecimal switch 10 decimal

Guess you like

Origin www.cnblogs.com/yincq/p/12095876.html