byte[] a = new byte[3] { 0x31, 0x34, 0x39 }; byte[] b = new byte[3]; for (int i = 0; i < a.Length; i++) { b[i] = a[i] - 0x30; } 不得行
byte[] a = new byte[3] { 0x31, 0x34, 0x39 }; byte[] b = new byte[3]; for (int i = 0; i < a.Length; i++) { b[i] = (byte)(a[i] - 0x30); }自己做个数据类型转换就好了
============================================================= 没有转型,这样才正确 byte[] a = new byte[3] { 0x31, 0x34, 0x39 }; byte[] b = new byte[3]; for (int i = 0; i < a.Length; i++) { b[i] =(byte)(a[i]-0x30); }
class MyByteArray { private readonly byte[] _array; public MyByteArray(byte[] bytearray) { _array = bytearray; } public byte this[int index] { get { return (byte)(_array[index] - 0x30); } } }
byte[] b = new byte[3];
for (int i = 0; i < a.Length; i++)
{
b[i] = a[i] - 0x30;
}
不得行
byte[] b = new byte[3];
for (int i = 0; i < a.Length; i++)
{
b[i] = (byte)(a[i] - 0x30);
}自己做个数据类型转换就好了
没有转型,这样才正确
byte[] a = new byte[3] { 0x31, 0x34, 0x39 };
byte[] b = new byte[3];
for (int i = 0; i < a.Length; i++)
{
b[i] =(byte)(a[i]-0x30);
}
{
private readonly byte[] _array;
public MyByteArray(byte[] bytearray)
{
_array = bytearray;
} public byte this[int index]
{
get
{
return (byte)(_array[index] - 0x30);
}
}
}