Skip to content

Instantly share code, notes, and snippets.

@eralston
Last active December 14, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eralston/5061708 to your computer and use it in GitHub Desktop.
Save eralston/5061708 to your computer and use it in GitHub Desktop.
A simple static class in C# for ASP.Net MVC 4 that extends @html with a method for checking if the current build is debug or release
/// <summary>
/// Class for holding extensions for the HtmlHelper function
/// </summary>
public static class HtmlHelperExtensions
{
/// <summary>
/// Returns true if the build is DEBUG; otherwise, returns false
/// </summary>
/// <param name="htmlHelper"></param>
/// <returns></returns>
public static bool IsDebug(this HtmlHelper htmlHelper)
{
#if DEBUG
return true;
#else
return false;
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment