In this post, let us learn how to add Using directive automatically while pasting a line of code in Visual Studio. Visual Studio always brings improvements with developer productivity. No matter how small some of the features are, they always help improve developer productivity. One such part is Add missing using directives on paste. This feature automatically adds a directive when you paste a line of code. However, it’s turned off by default. You need to turn it on before you see it in action.
Add Using directive automatically on Paste
To turn on this feature, navigate to Tools > Options > Text Editor > C#. and select Add missing using directives on paste. Refer to the below image.
Related Tip: Using or Using ?
Once this is enabled, in the code editor, whenever you paste some line, which has reference assembly and the directives are not included, it will be automatically included.
Check this out in action.
Hope this helps.
Read : Exploring Azure DevOps APIs
Pingback: The Morning Brew - Chris Alcock » The Morning Brew #3228
Pingback: Dew Drop – May 11, 2021 (#3440) – Morning Dew by Alvin Ashcraft