Recent Articles

Jul 2025

It's Not Wrong to Say We're Equal

by in CodeSOD on

Aaron was debugging some C# code, and while this wasn't the source of the bug, it annoyed him enough to send it to us.

protected override int DoCompare(Item item1, Item item2)
{
	try
	{
		DateTime thisDate = ((DateField)item1.Fields["Create Date"]).DateTime;
		DateTime thatDate = ((DateField)item2.Fields["Create Date"]).DateTime;

		return thatDate.CompareTo(thisDate);
	}
	catch (Exception)
	{
		return 0; // Sorry, ran out of budget!
	}
}