关于如何将代码中的“可食用”转换为会话以在不同页面上显示为标签的任何想法。帮助将不胜感激。
标签将显示类似可以吃的信息
代码如下
public int totalCalories()
{
return grams * calsPerGram;
}
public string getFruitInfo()
{
string s;
if (edible == true)
{
s = fName + " is good and it has " + totalCalories() +
"calories";
}
else
{
s = "Hands off! Not edible";
//edible = Sesion ["ediblesesion"] as bool;
// Session ["ediblesession"] = edible;
}
return s;
}
}