简体   繁体   中英

Why doesn't intellisense show the appropriate methods according to what I am passing in?

Like there are 3 methods like:

Modify ( int arg )
Modify ( double arg )
Modify ( string arg )

And if I am passing in a double variable, it should automatically navigate to method #2, instead of me scrolling down to see if there is a method that gets a double, right?

I can think of two reasons. First, Intellisense would have to then be aware of implicit conversion rules and the like, and end up being about as smart as the compiler. They probably just decided that the easy implementation was good enough (imagine cases more complicated than yours - eg passing function results directly to another function). Also, I think it would be annoying if Intellisense hid the particular overload that I wanted to call (because maybe an argument had the wrong type) - I'd rather finish writing the code with the function I want, and then go back and fix any errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM