我正在编写一个小游戏,我想从一个将其传递给其他方法的方法传递,该方法将对该数字执行某些操作。这是我尝试的:
public static int MatchesStart()
{
Console.Write("how many matches do you want to play with?");
string matchesStartingNumber = Console.ReadLine();
int matchesOpeningNumber = Convert.ToInt32(matchesStartingNumber);
for (int i = 0; i < matchesOpeningNumber; i++)
{
Console.Write("|");
}
return matchesOpeningNumber;
}
public static int RemoveMatches( *** i want here: matchesOpeningNumber )
{
///to do somthing with matchesOpeningNumber.
}
当我尝试将其传递给第二种方法时,它失败了.. :( 为什么会这样?