Category: C#

  • Add Additional Information to Your Exceptions

    When Enterprise Library was called Microsoft Application Blocks, if you wanted to log an Exception, you would write (assuming “ex” is an Exception): ExceptionManager.Publish(ex) And if you wanted to log some extended properties you could do something like this: NameValueCollection customerInfo = new NameValueCollection(); customerInfo.Add(“name”,”scott”); customerInfo.Add(“email”,””); ExceptionManager.Publish(ex,customerInfo); Now that I am upgrading all legacy code […]

  • Fun with #region

    I am not sure if I did this on accident, or my intern did it, but I found this in my code: #region Constructors//code here #endregion Constructors I was not aware you can put a tag after #endregion. Kind of nice to clearly delineate long regions. Not that it really matters, but Visual Studio allows […]

  • Learning C# over VB.NET

    I just finished writing a long 'ol email to a friend who wants to do a project in VB.NET since his background is in legacy ASP. Although my points have been illustrated by many over and over, I thought I would post what I wrote in the hopes others can add to my list. I […]

  • Hiding a Row in ASP.NET

    Many things that I come across are “No Duh”. This is one of them. I frequently see code from other programmers that incorrectly use Panel for the purpose of hiding content. What they don’t understand is that a Panel tag renders a table, and as such can’t be used around Table Rows. For instance, this: […]

  • ReSharper Help and Tutorial

    I have found that for me, ReSharper wasn't even close to as great a help until I changed my operating basis regarding how I write code. Many times there are many subtle things you do differently, which just causes pain with ReSharper. It also wasn't easy for me to find and remember all the key […]

  • Binding a DropDownList to an Enumeration

    Ok, well its not really binding to it.

  • String to Enum

    I have to do this now and then and each time I don't write this code perfect the first time.