所以我正在尝试编写一种方法来查看表单上的所选项目并计算披萨的成本。变量声明为十进制类型,但它告诉我我不能使用+ =运算符来添加变量。但是,如果我把它保留为小数,只需添加整数就可以了。
$(document).ready(function(){
lightbox.init();
});
答案 0 :(得分:7)
这应该有效
WebRequest request = WebRequest.Create("some_url");
request.Headers.Add("cookie", "some_cookie");
Stream objStream = request.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
while (sLine != null)
{
i++;
sLine = objReader.ReadLine();
if (sLine != null)
Console.WriteLine(sLine);
}
答案 1 :(得分:1)
你需要施放
private decimal findTotal( )
{
decimal TotalDec = 0;
//add size cost to total
if (sizeDDB .SelectedIndex == 0)
TotalDec += 12;
if (sizeDDB.SelectedIndex==1)
TotalDec += 14;
if (sizeDDB.SelectedIndex == 2)
TotalDec += 16;
//add chrust cost
if (crustDDB.SelectedIndex == 2)
TotalDec += 2;
// add topping cost
if (sausageCB.Checked)
TotalDec += 2;
if (pepperoniCB.Checked)
TotalDec += (decimal)1.5; //there is no automatic casting from double to decimal, so you have to do it manually like this
return TotalDec;
}