Aggregate

对序列应用累加器函数。

        /// <summary>
        /// 计算校验和,SUM
        /// </summary>
        public byte CalculateCheckSum(byte[] data)
        {
            int sum = data.Aggregate(0, (current, t) => current + t);
            return (byte)(sum & 0x00ff);
        }
原文地址:https://www.cnblogs.com/pangkang/p/6070076.html