格式转换

服务器的字符串一般是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

 

 

posted @ 2014-12-14 13:46  听雨歌楼上  阅读(143)  评论(0编辑  收藏  举报