Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript comments in razor mvc3

For javascript comments, I usually try to follow something similar to these guidelines. However, the Razor engine seems to throw up when it sees stuff like this in the cshtml file:

/**
 * This is my function.
 * @param parm1 this is first parameter
 * @param parm2 this is second parameter
 */

The @ sign seems to cause parser errors, since that's a special character in Razor. Anyway, I just wondered what other people are doing. I know I could probably use Razor comments and do something like this:

@*param parm1 this is first parameter *@

But that just feels wrong on so many levels.

like image 567
dcp Avatar asked Oct 15 '25 14:10

dcp


1 Answers

Try this:

/* 
* This is my function. 
* @@param parm1 this is first parameter 
* @@param parm2 this is second parameter 
*/ 

To write @ you just need to repeat it @@ in Razor view.

like image 64
webdeveloper Avatar answered Oct 18 '25 09:10

webdeveloper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!