私はこの方法を持っています:
public static void Add(int _Serial, string _Name, long? _number1, long? _number2)
{
// ...
}
send date to メソッドに次のコードを使用します。
long? _num1;
long? _num2;
if (txtNumber1.Text != null && txtNumber1.Text != "")
{
_num1= long.Parse(txtNumber1.Text);
}
if (txtNumber2.Text != null && txtNumber2.Text != "")
{
_num2= long.Parse(txtNumber2.Text);
}
Add(22, "Kati", _num1, _num2)
しかし、エラー_num1
&_num2
でAdd(...)
。
エラー:
割り当てられていないローカル変数 '_num1' の使用
割り当てられていないローカル変数 '_num2' の使用