A code sequence I’ve found while analyzing some ASP.NET legacy code.

        var isAlpha = string.Empty;
        try { isAlpha = Convert.ToString(Request.QueryString["isAlpha"]); } catch{}

The normal code sequence should be

        var isAlpha = Request.QueryString["isAlpha"] ?? string.Empty;
Advertisements