I have a class called "TradeHolder" (code below). I have a List<TradeHolder> which I wish to sort. The question I have is sometimes I want sort the List on "MaxWin" (double) other times I will need to sort it on "TradeReturn" (double) other times "PeriodLosing" (int) etc.
Also I may need to sort it ascending or descending. How is the best way to do this using the IComparable interface?
public class TradeHolder : IComparable<TradeHolder>
public double TradeReturn, BasePnL, MaxLose, MaxWin;
public int PeriodInTrade, PeriodLosing;
public string ExitReason, LockInLevel;
public Boolean LockInActive;
public enumOutCome Outcome;
public int IComparable.CompareTo(TradeHolder TH)