Difference in behaviour for hint "Method with params invoked. Have you intended..."

Hi,

I found another sample where RS 6.0 behaves differently for two statements. Only one is marked with hint "Method with params invoked. Have you intended to call more specific method". Another statement with same "error" ist not marked. Please see attached sample solution.

Thanks,

Stefan



Attachment(s):
RS6Sample2.zip
2 comments
Comment actions Permalink

In your first example, there are two possible overloads you might have intended to call:

  • Format(IFormatProvider, String, params Object[])
  • Format(String, Object, Object, Object)


R# knows that the compiler will call the first overload (the params method), but doesn't know if you meant to call the second overload.

In your second example, there is only one possible overload; there is no overload of Format which accepts five parameters, so it's obvious that you meant to call the "params" method.

0
Comment actions Permalink

Hi again,

once more, looking thoroughly at my code and thinking twice helps ;)

Stefan

0

Please sign in to leave a comment.