Add explicit cast
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
This code generation applies to:
What: Lets you automatically add an explicit cast to an expression, based on usage.
When: You need to add an explicit cast to an expression and want to properly assign it automatically.
Why: You could add an explicit cast to an expression manually, however this feature adds it automatically based on the code context.
How to use it
Place your caret on the error.
Press Ctrl+. to trigger the Quick Actions and Refactorings menu.
Select Add explicit cast.