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:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...