What does @: mean in ASP.net MVC Razor?
In MVC, @
is the respective char that allows you to use razor inside HTML (inside a .cshtml) which in runtime (or precompiled) will be converted to c#.
With @
you may write C# within HTML and with @:
you may write HTML within C#.
Example:
@foreach (TestClass item in Model)
{
@:@item.Code - @item.Name
}
Without the @:
it wouldn't be possible to do this, since all the chars after the first @
will be considered as C#.
This way you are saying that you are getting the two variables from item
and placing the char -
between them and the result is a content block (or html/text)