c# - 收到 'The best overloaded match for (...) has some invalid arguments' 时如何找出哪个参数无效?

标签 c# visual-studio

给定一个函数

public static void foo(string bar, int baz) { 

}

当这样调用时,Visual Studio 将显示错误The best overloaded method match for Foo(string,int) has some invalid arguments:

string bar;
string baz;
foo(bar, baz);

在这个例子中,解决方案很简单,baz 应该是一个int
但是我如何找出哪些参数无效呢?

最佳答案

在这种情况下,visual studio 将按以下顺序在 Error List 中显示该错误

Error 1 Cannot implicitly convert type 'Type A' to 'TypeB' SourceFIle.Cs Line Column Project

如果未启用错误 View 子窗口,请通过从“ View ”菜单激活来启用它

View -> Error List

希望对你有帮助

关于c# - 收到 'The best overloaded match for (...) has some invalid arguments' 时如何找出哪个参数无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27719115/

相关文章:

c++ - Visual Studio std::stringstream pubsetbuf 不起作用

c# - 如何仅在 .nuspec 文件中标记运行时的依赖项?

c# - 使用C#在字符串中的适当位置插入特殊字符

c# - 在 winrt c# 中加密字符串并在 c# .net 中解密

C# - 每次向下循环 float

c# - Entity Framework : wrong return type of stored procedure

c# - 如何在基类中使用逆变参数?

visual-studio - 当我尝试在 TFS 源代码管理下打开解决方案时 Visual Studio 崩溃

c++ - Visual Studio 错误。它在 CodeBlocks 中工作...要求 const

java - Minecraft 启动器登录代码