我传递的参数的函数作为 VAR
键入。它不接受,我怎么传递给函数?
I am passing the parameter to the function as a var
type. It is not accepting, how do I pass to the function?
示例
var Input = ................
listview1.itemsource = getinput(Input);
public List<answers>getinput(var inp)
{
................
..................
}
下面的函数不接受 VAR
。我该怎么办?
Here the function is not accepting the var
. What can I do?
无功当一个局部变量声明,并在同一语句初始化才能使用;该变量不能被初始化为null,或者一个方法组或匿名函数。
var can only be used when a local variable is declared and initialized in the same statement; the variable cannot be initialized to null, or to a method group or an anonymous function.
MSDN:隐式类型的局部变量