int 转换成2位byte 求教解决方法
int 转换成2位byte 求教
拿到一个长度 现在需要用2个字节的 byte 16进制 表示出来 不知道怎么写 请高手指导
比如
int i=16;
就表示成 byte[] {00,10}
需要考虑 超过255 的的情况
------解决方案--------------------
BitConverter.GetBytes 方法 (Int32)
http://msdn.microsoft.com/zh-cn/library/de8fssa4%28v=vs.110%29.aspx
------解决方案--------------------

未考虑超255
拿到一个长度 现在需要用2个字节的 byte 16进制 表示出来 不知道怎么写 请高手指导
比如
int i=16;
就表示成 byte[] {00,10}
需要考虑 超过255 的的情况
------解决方案--------------------
BitConverter.GetBytes 方法 (Int32)
http://msdn.microsoft.com/zh-cn/library/de8fssa4%28v=vs.110%29.aspx
------解决方案--------------------
未考虑超255