I m declaring the following syntax in MVC Razor view:
@{
foreach (var speaker in Model)
{
speaker.Name;
}
}
and getting error
Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
I am able to correct by adding a @ with speaker.Name;
but why it is ? I m sorry, I'm new to Razor but while I'm in code block @ {} why I am required to use @ again. Even I m not mixing it with HTML ?
Help please.