标签:turn text nbsp return bytes 数组 efault string public
public byte[] ShortToByte(short value) { return BitConverter.GetBytes(value); } public short ByteToShort(byte[] arr) { return BitConverter.ToInt16(arr,0); }
public byte[] StringToByte(string value) { return Encoding.UTF8.GetBytes(value); //return Text.Encoding.Default.GetBytes (value); } public string ByteToString(byte[] arr) { return Encoding.UTF8.GetString(arr); //return Text.Encoding.UTF8.GetString (arr, 0, arr.Length); }
public byte[] IntToByte(short value) { return BitConverter.GetBytes(value); } public int ByteToInt(byte[] arr) { return BitConverter.ToInt32(arr,0); }
标签:turn text nbsp return bytes 数组 efault string public
原文地址:https://www.cnblogs.com/daimaxuejia/p/11942943.html