9

I keep seeing *@ everywhere in a Visual Studio MVC Web app within all the CSHTML files, within the script tags.

Search engines refuse to let me search those characters which is ridiculous and I have struggled for hours trying to figure this out.

The lines that have the *@ are the same colors as the comments, does that mean it's commented out?

Talal Nabulsi
  • 389
  • 1
  • 5
  • 10

3 Answers3

17

in MVC @(at) using for binding with Model . For example :

@model yourModel;

@foreach(var  item in Model){
  @item.yourItemFromYourModel;
}

So double at like this @* *@ using for comments. For ex:

@*YourComment*@

Hope it helps ;) Here: https://stackoverflow.com/a/3383662/4640991

Community
  • 1
  • 1
Husni Salax
  • 1,968
  • 1
  • 19
  • 29
4

Jup you are correct using the @* *@ block you can set some content like HTML or Server code in your razor code as a comment.

Documentation: ASP.NET MVC 3: Server-Side Comments with Razor

Mivaweb
  • 5,580
  • 3
  • 27
  • 53
0

In fact in Visual Studio, if you just select a block of code and choose "Comment block" button in the toolbar, it will automatically put the @* and *@ So it is for comments in cshtml file