List排序

简单的实现一个利用list排序的方法:

 

   this.CallHistoryList.Sort(CompareTo);
  public  int CompareTo(CallHistory left, CallHistory other)
        {
             if (left.StartTime > other.StartTime)
            {
                 return - 1;
            }
             else  if (left.StartTime == other.StartTime)
            {
                 return  0;
            }
             else
            {
                 return  1;
            }

        }

 

你可能感兴趣的:(list排序)