Я пытаюсь написать ниже простой код на странице бритвы, но это всегда выдает ошибку.
( @gallery.Images.Count images ) // expect : ( 23 images )
Но, как ни странно, код ниже работает
(@Model.RateCount rates)
Я получаю ошибку компиляции, а не исключение времени выполнения
Полная страница cshtml находится ниже.
@using Something.UI.Models.ViewModels
@model List<ImageGalleryUI>
<div class="albumlist">
@foreach (ImageGalleryUI gallery in Model)
{
<a href="@Html.ActionLinkRef(gallery.DisplayAction)">
<img src="@gallery.AlbumImageSrc" alt="@gallery.AlbumName" width="150px"/>
</a>
@Html.ActionLink(gallery.DisplayAction)
( @gallery.Images.Count images )
}
</div>
А вот и ошибка
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1646: Keyword, identifier, or string expected after verbatim specifier: @
Source Error:
Line 9: </a>
Line 10: @Html.ActionLink(gallery.DisplayAction)
Line 11: ( @{gallery.Images.Count} images )
Line 12: }
Line 13: </div>