Hello friends,
I have to sort array list which contains struct object.I am giving code here.can i use IComparable interface for struct to sort the list.
Tell me this is right which i have done.My code is working fine.
struct ScheduleReportStruct:IComparable
{
public string m_ProjectName;
public int m_ScheduleCnt;
public ArrayList m_ResourceInfoList;
public ArrayList m_ScheduleList;
public float m_MakeSpan;
public int CompareTo(object obj)
{
ScheduleReportStruct t_ScheduleReportStruct;
t_ScheduleReportStruct = (ScheduleReportStruct)obj;
return m_MakeSpan.CompareTo(t_ScheduleReportStruct.m_MakeSpan);
}
}
ScheduleReportStruct t_ScheduleReportStruct=new ScheduleReportStruct();
myProjectlist.Add(ScheduleReportStruct);
myProjectlist.sort();
Thanks