HashCodeUtils.cs 413 B

123456789101112131415161718
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Ips.Library.Basic
  6. {
  7. public class HashCodeUtils
  8. {
  9. public static int CombineHashCodes(IEnumerable<object> objects)
  10. {
  11. unchecked
  12. {
  13. return objects.Aggregate(17, (current, obj) => current * 23 + (obj?.GetHashCode() ?? 0));
  14. }
  15. }
  16. }
  17. }