Monday

sample of sorting algoritm for collection of Invoice objects by date-time

Collection is type of System.Collections.Generic.List

// sorting class 
public class InvoiceSorterbyDueDate : System.Collections.Generic.IComparer<BaseObject>
{
#region IComparer<Invoice> Members
public int Compare(BaseObject x, BaseObject y){
return ((Invoice)x).DueDate.CompareTo(((Invoice)y).DueDate);
}
#endregion
}


//call
IComparer<BaseObject> ins = new InvoiceSorterbyDueDate();
p.InvoiceCollectionToCheck.Sort(ins);

//


more...

No comments:

make ubuntu business casual

to make ubuntu business casual - make it black remove background: gsettings set org.gnome.desktop.background picture-options ...