c# - 尝试调用具有 out 参数的函数时出现问题

标签 c# asp.net

我有这样的功能:

example(long a,long b,string c,DateTime d,DateTime e,out decimal f)

当我尝试调用它时,我正在这样做:

long a =1;
long b=2;
string c="";
DateTime d=DateTime.Now;
DateTime e=DateTime.Now;
decimal f=0;

example(a,b,c,d,e,f) --> Here is giving me the error : the best overloaded method has some invalid argument 

你能帮我解决这个问题吗

最佳答案

你需要调用example(a,b,c,d,e, out f);

而且f不需要初始化,最好不要初始化(误导):

//decimal f=0;
decimal f;

关于c# - 尝试调用具有 out 参数的函数时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18843195/

相关文章:

c# - WCF 反序列化的对象属性的空值

C# parallel.for 循环完全使用 CPU1 但不使用 CPU2 的内核

c# - 创建对象后检查是否为 null

c# - JSON.net - 使用路径字符串写入 JSON/JObject

javascript - 一键提交多个单选按钮值 ASP.NET MVC

c# - 访问被拒绝错误

c# - AJAX 不触发 WebMethod 但在成功时返回整个 HTML 页面

c# - 遍历 gridview 并不总是有效

c# - 如何在查询 C# 中使用 Linq 和 Dictionary 从 List<> 获取元素?

php - 我想在我的网站上添加交互式日历