MVC Helper Extension issue
- by BeCool
Hi,
I need to implement a HtmlHelper extension in my MVC project simply just to output some string but ONLY in the DEBUG mode, not in REALEASE.
My first attempt would be:
[Conditional("DEBUG")]
public static string TestStringForDebugOnly(this HtmlHelper helper, string testString)
{
return testString;
}
But obviously that would give a compile error:
"The Conditional attribute is not valid because its return type is not void."
So my understanding is once you set [Condition] attribute, it doesnt allow to return anything? why?
What is other way to implement this kind of function? anyone help would be much appreciated.
Thanks!