kalyfe
kalyfe

Reputation: 1005

How do I find out which argument is invalid when receiving 'The best overloaded match for (...) has some invalid arguments'?

Given a function

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

}

Visual Studio will display an error The best overloaded method match for Foo(string,int) has some invalid arguments when called thusly:

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

In this example the solution is simple, baz should be an int.
But how do I find out which of the arguments is invalid?

Upvotes: 3

Views: 463

Answers (1)

Kavindu Dodanduwa
Kavindu Dodanduwa

Reputation: 13069

In such a case visual studio will show that error in Error List in following order

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

If Error View sub window is not enabled, enable it by activating from View menu

View -> Error List

Hope this would help you

Upvotes: 4

Related Questions