// 数字二,八,十,十六进制转成字符串
Convert.ToString(要转的数, 进制);
例子: 
string strResult;
strResult = Convert.ToString(253, 2);// 結果:strResult=11111101 
strResult = Convert.ToString(253, 8);// 結果:strResult=375 
strResult = Convert.ToString(253, 10);// 結果:strResult=253 
strResult = Convert.ToString(253, 16);// 結果:strResult=fd 

// 字符串转数字二,八,十,十六进制
Convert.ToInt32(要转的字符串, 进制);
例子:
int intResult;
intResult = Convert.ToInt32("11111101", 2);// 結果:intResult=253 
intResult = Convert.ToInt32("375", 8);// 結果:intResult=253 
intResult = Convert.ToInt32("253", 10);// 結果:intResult=253 
intResult = Convert.ToInt32("fd", 16);// 結果:intResult=253
//整理下:
//十进制转二进制
Convert.ToString(69, 2);
//十进制转八进制
Convert.ToString(69, 8);
//十进制转十六进制
Convert.ToString(69, 16);
//二进制转十进制
Convert.ToInt32("100111101", 2);
//八进制转十进制
Convert.ToInt32("76", 8);
//十六进制转十进制
Convert.ToInt32("FF", 16);

相关文章:

  • 2022-01-19
  • 2021-05-21
  • 2021-09-01
  • 2022-12-23
  • 2021-10-11
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2022-03-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案