Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 868
kalyfe Avatar asked Dec 13 '25 09:12

kalyfe


1 Answers

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

like image 111
Kavindu Dodanduwa Avatar answered Dec 15 '25 21:12

Kavindu Dodanduwa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!