Byte[]是int类型的数组。可是
Byte[2] = Byte[0] + Byte[1]无法直接相加,需要什么样的转换呢?

解决方案 »

  1.   

    如果是byte需要转换
    Byte[2] = (byte)(Byte[0] + Byte[1])
      

  2.   

    Byte[2] = Convert.ToInt32(Byte[0]) + Convert.ToInt32(Byte[1]);
      

  3.   

    错误 1 无法将类型“int”隐式转换为“byte”。存在一个显式转换(是否缺少强制转换?)
      

  4.   

    或先转化为string,再转为int
    Encoding myEncoding = Encoding.GetEncoding("utf-8");
    byte[] mB = new byte[]{};
    string str = myEncoding.GetString(byte[] mB)
    http://www.cnblogs.com/ly4cn/archive/2005/09/08/232523.html