首页 > 其他 > 详细

格式转换

时间:2014-12-14 14:32:55      阅读:269      评论:0      收藏:0      [点我收藏+]

服务器的字符串一般是byte[]格式

byte[]转string(c#)

byte[] byteArray = System.Text.Encoding.Default.GetBytes(str);

string str = System.Text.Encoding.Default.GetString(byteArray);

byte[]转char[]

GetChars

 

uint转int

uint n = 3;

int i = checked((int)n); // throws OverflowException if n > Int32.MaxValue

int i = unchecked((int)n); // converts the bits only i will be negative if n > Int32.MaxValue

int i = (int)n; // same behavior as unchecked

or 

int i = Convert.ToInt32(n); // same behavior as checked

 

 

格式转换

原文:http://www.cnblogs.com/yushui/p/4162508.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!