試圖爲我的受保護字符串函數中的每個循環添加一個,但不斷收到錯誤:「並非所有代碼路徑都返回一個值」。請幫忙。對於受保護字符串函數中的每個循環
protected string GetAmountStyle()
{
{
foreach (LFConnection ProdCurrConn in AllConn)
{
if (Login.Contains(ProdCurrConn.UserName) == false)
if ((Request.Browser.Browser.Contains("IE") == true))
{
//th1.Attributes.Add("style", "padding-right: 5px;");
//return "padding-right: 1px;";
return "background-color: #FFFF66;";
}
else
{
//th1.Attributes.Add("style", "padding-right: 5px;");
return "background-color: #FFFF66;";
}
else
{
//th1.Attributes.Add("style", "padding-right: 5px;");
return string.Empty;
}
}
提示:如果AllConn爲空會發生什麼? – briantyler