Lent is a yearly Catholic Tradition that involves sacrifice, penance and generally a lot of guilt (When you’re Catholic, what *doesn’t* involve guilt?).  Last year, as Lent approached far more rapidly than I would have liked, I panicked because I had no idea what to ‘give up’ for Lent.  As Catholics, we generally ‘give something […]

Little Gems: ToShortDate Extension Method

I’m really surprised that the DateTime struct doesn’t have a way to compare if two dates are equal, disregarding the time.  To help that, I’ve created an extension method:   public static class DateTimeExtensions { public static DateTime ToShortDate(this DateTime dateTime) { return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day); } }   With this you can compare […]

Visiting Exception Handlers

Scott Hanselmen recently posted a blog post titled Good Exception Management Rule of Thumb, Back to Basics Edition:    public void HandleException(String strMessage){ //Log to trace file only if app settings are true if (Properties.Settings.Default.TraceLogging == true) { try { TraceSource objTrace = new TraceSource(“YadaYadaTraceSource”); objTrace.TraceEvent(TraceEventType.Information, 5, strMessage.ToUpper()); objTrace.Flush(); objTrace.Close(); } catch { //do nothing […]