メソッドを使用して設定したい変数があります。メソッドを介した変数の設定
string size
double sizeprice
これは、メソッドは
PizzaSizeUI(choice, size, sizeprice, Quit);
と呼ばれている場所ですが、私はこの方法自体から来た値を印刷してきた、と彼らは設定されているあるコード
public static void PizzaSizeUI(int choice, string size, double sizeprice, bool Quit){
Console.WriteLine("Size");
Console.WriteLine("1.Small");
Console.WriteLine("2.Medium");
Console.WriteLine("3.Large");
//To Check if Int is entered, If a character/string is entered, program doesn't crash.
while (!int.TryParse(Console.ReadLine(), out choice))
{
break;
}
if (choice == 1)
{
size = "Small";
sizeprice = 5.00;
Quit = true;
}
else if (choice == 2)
{
size = "Medium";
sizeprice = 7.00;
Quit = true;
}
else if (choice == 3)
{
size = "Large";
sizeprice = 10.00;
Quit = true;
}
}
ですしかし、外の値は「選択されていません」と0のままで設定されています。 メソッドを使用して変数を設定するにはどうすればよいですか?