Reputation: 11623
I'm having issues do linq queries inside of a code block.
@{
var foo = @Model.Things.Select((value, index) => new { value, index });
}
The problem is the new{}, it sees the second bracket as closing the entire code block. Any way to escape it?
Upvotes: 7
Views: 6536
Reputation: 9598
Remove the @
from Model
:
@{
var foo = Model.Things.Select((value, index) => new { value, index });
}
Upvotes: 14
Reputation: 5103
Please try
@{
var foo = Model.Things.Select((value, index) => new { value, index });
}
Upvotes: 5