ArrayList Policies = CreateListofPolicies() ;
SLPolicy.SortBy = "PolicyNumber";
Policies.Sort();
if that's what you want, you need to implement some class like below:
[Serializable]
public class SLPolicy : IComparable
{
#region IComparable Members
public int CompareTo(object obj)
{
switch (_container.Container.SortKind)
{
case SLSortableKind.AgentCodeAsc:
return _agentCode.CompareTo(((SLPolicy) obj).AgentCode);
case SLSortableKind.AgentCodeDesc:
return ((SLPolicy) obj).AgentCode.CompareTo(_agentCode);
case SLSortableKind.InsuredNameAsc:
case SLSortableKind.InsuredNameDesc:
case SLSortableKind.ExpDateAsc:
return _expDate.CompareTo(((SLPolicy) obj).ExpDate);
case SLSortableKind.ExpDateDesc:
return ((SLPolicy) obj).ExpDate.CompareTo(_expDate);
default:
return 0;
}
}
#endregion
}
No comments:
Post a Comment