传递参数 [英] Passing the parameter

查看:93
本文介绍了传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我传递的参数的函数作为 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:隐式类型的局部变量

这篇关于传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆