对序列应用累加器函数。

 

Aggregate

        /// <summary>
        /// 计算校验和,SUM
        /// </summary>
        public byte CalculateCheckSum(byte[] data)
        {
            int sum = data.Aggregate(0, (current, t) => current + t);
            return (byte)(sum & 0x00ff);
        }

 

相关文章:

  • 2022-12-23
  • 2021-06-24
  • 2021-10-05
  • 2022-12-23
  • 2021-04-19
  • 2021-03-26
  • 2021-10-29
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案