IDateDataPoint.cs 686 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. namespace MuchInfo.Chart.Data.Interfaces
  4. {
  5. /// <summary>
  6. /// 日期数据点接口
  7. /// </summary>
  8. public interface IDateDataPoint
  9. {
  10. /// <summary>
  11. /// 时间
  12. /// </summary>
  13. DateTime Date { get; set; }
  14. }
  15. /// <summary>
  16. /// 比较时间
  17. /// </summary>
  18. public class DataPointComparer<T> : IEqualityComparer<T>
  19. where T : IDateDataPoint
  20. {
  21. public bool Equals(T x, T y)
  22. {
  23. return x.Date.CompareTo(y.Date) == 0;
  24. }
  25. public int GetHashCode(T obj)
  26. {
  27. return obj.Date.GetHashCode();
  28. }
  29. }
  30. }