-3
こんにちはイムは、ユーザーがボタン1を選択したときに、それは別のクラスのメソッドを呼び出します。 ;別のクラスのメソッドを呼び出そうと#
を呼び出しますこれは、過負荷がメソッドのMyMethodは0引数のシステムを使用して
using System;
namespace crap
{
class firstClass
{
public static void Main (string[] args)
{
int choice = 0;
while (choice != 1 || choice != 2) {
Console.WriteLine ("Press 1 for choice 1 or 2 for choice for choice 2");
choice = Convert.ToInt32 (Console.ReadLine());
if (choice == 1) {
crap.secondClass.myMethod();
}
if (choice == 2) {
}
}
}
}
public class secondClass{
public static void myMethod(int later, int later2)
{
Console.WriteLine("You chose option 1");
}
}
}
'myMethod'は、2つの整数パラメータを取ります。あなたはそれらを渡す必要がありますまたあなたのループは間違っています。 1!= 2と2!= 1なので、誰かが有効な数字(2または1)を入力したとしても、それはループを続けます。あなたは '||'の代わりに '&&' – pinkfloydx33