I am using dynamic objects in a project, and I'd like to provide intellisense for the object. I understand that Visual Studio can't know what to show for intellisense, but if I can plug into the intellisense, I do know what entries should show up.
Is there a way to extend Visual Studio's intellisense? If so, any pointers?
Thanks!
The short answer is YES, it is a bad practice to use dynamic. Why? dynamic keyword refers to type late binding, which means the system will check type only during execution instead of during compilation. It will then mean that user, instead of programmer, is left to discover the potential error.
IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Complete Word. These features help you to learn more about the code you're using, keep track of the parameters you're typing, and add calls to properties and methods with only a few keystrokes.
Dynamic objects expose members such as properties and methods at run time, instead of at compile time. This enables you to create objects to work with structures that do not match a static type or format.
You can use Editor Extension Points.
You can find specific information for extending Intellisense near the bottom of this page:
Editor Extension Points
From this page you can get information about ICompletionSource and ICompletionSourceProvider which are the two interfaces you must implement to provide autocompletion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With