if (byteArr.Length != 11 && byteArr.Length != 15) return null;byteArr.Length!=11为假  
byteArr.Length!=15为真。。为什么还返回 null呢

解决方案 »

  1.   

    因为是&&false && false = false
    false && true = false
    true && false = false
    true && true = true
      

  2.   

    && 两个都为真才会true
      

  3.   

    这里应该是没有问题的..是不是哪儿例有错误啊 要不你这样试试看 if (byteArr.Length != 11 && byteArr.Length != 15) {return null;}  按道理来说是不执行的 仔细看看你的代码吧
     
      

  4.   

    或且非 基础问题
    && 是两个条件同时成立(true)有一个不成立都无法执行true的
      

  5.   

    if ((!(byteArr.Lengt == 11)) || (!(byteArr.Length == 15)))
    {
    //...
    }
      

  6.   

    用 || 其中一个为true就为true。