我在 asp .net mvc helper 函数中遇到了意外的 pharantesis 错误。一切似乎都很好,它给出了一个“}”错误。
@helper GetirIcerikStil(string anaMenuKontrol, string solMenuKontrol, string sekmeKontrol, UrlHelper url){
var d = DateTime.Now;
var tazele = d.ToLongTimeString();
anaMenuKontrol = BuyutIlkHarf(anaMenuKontrol);
solMenuKontrol = BuyutIlkHarf(solMenuKontrol);
sekmeKontrol = BuyutIlkHarf(sekmeKontrol);
var href1 = string.IsNullOrEmpty(anaMenuKontrol) ? "" : @url.Content("~/_Docs/SoruCevap/" + anaMenuKontrol + "/_Stil/Index.less?" + @tazele);
var href2 = string.IsNullOrEmpty(solMenuKontrol) ? "" : @url.Content("~/_Docs/SoruCevap/" + anaMenuKontrol + "/" + solMenuKontrol + "/_Stil/Index.less?" + @tazele);
var href3 = string.IsNullOrEmpty(sekmeKontrol) ? "" : @url.Content("~/_Docs/SoruCevap/" + anaMenuKontrol + "/" + solMenuKontrol + "/" + sekmeKontrol + "/_Stil/Index.less?" + @tazele);
if (string.IsNullOrEmpty(href1))
{
<link href="@href1" class="icerikStil anaMenu" rel="stylesheet" type="text/css" />
if (string.IsNullOrEmpty(href2))
{
<link href="@href2" class="icerikStil solMenu" rel="stylesheet" type="text/css" />
if (string.IsNullOrEmpty(href3))
{
<link href="@href3" class="icerikStil sekme" rel="stylesheet" type="text/css" />
}
}
<link href="#" id="icerikStilPozisyonu" />
}
}
第 32 行在浏览器中产生的错误是:
Compiler Error Message: CS1513: } expected
Source Error:
Line 30:
Line 31: <link href="#" id="icerikStilPozisyonu" />
Line 32: }
Line 33: }
Line 34: