{"id":24195,"date":"2019-08-22T10:20:27","date_gmt":"2019-08-22T17:20:27","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=24195"},"modified":"2021-09-29T12:16:22","modified_gmt":"2021-09-29T19:16:22","slug":"visual-studio-tips-and-tricks-increasing-your-productivity-for-net","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/visual-studio-tips-and-tricks-increasing-your-productivity-for-net\/","title":{"rendered":"Visual Studio Tips and Tricks: Increasing your Productivity for .NET"},"content":{"rendered":"<p><span class=\"TextRun BCX0 SCXW156549738\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun BCX0 SCXW156549738\">The .NET team is constantly thinking of new ways to make developers more productive. We&#8217;ve been working hard over the past year to take the feedback you&#8217;ve sent us and turn it into tools that you want! In this post I\u2019ll cover some of the latest productivity features available in<\/span><\/span>\u00a0<a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\"><strong>Visual Studio 2019 Preview<\/strong><\/a>.<\/p>\n<h2><span style=\"font-size: 18pt;\"><strong>Code Fixes and Refactorings<\/strong><\/span><\/h2>\n<div>\n<div><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">Code fixes and\u00a0<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"SpellingError SCXW161693491 BCX0\">refactorings<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">\u00a0are the code suggestions the compiler provides through the lightbulb and screwdriver icons. To trigger the\u00a0<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">Quick Actions and\u00a0<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"SpellingError SCXW161693491 BCX0\">Refactorings<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">\u00a0menu type (<\/span><\/span><strong><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">Ctrl\u00a0<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"ContextualSpellingAndGrammarError SCXW161693491 BCX0\">+\u00a0<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"ContextualSpellingAndGrammarError SCXW161693491 BCX0\">.<\/span><\/span><\/strong><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">) or (<\/span><\/span><strong><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">Alt + Enter<\/span><\/span><\/strong><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">). The list below contains the code fixes and <\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"SpellingError SCXW161693491 BCX0\">refactorings<\/span><\/span><span class=\"TextRun SCXW161693491 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161693491 BCX0\">\u00a0that are new in Visual Studio 2019 Preview. We\u2019d like to give a big thanks to the community for implementing and reviewing many of these!<\/span><\/span><span class=\"EOP SCXW161693491 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Wrap call chain<\/strong><\/span><\/div>\n<div>You can now <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/wrap-and-align-call-chains\">wrap chains of method calls<\/a> with a refactoring.<\/div>\n<p><img decoding=\"async\" class=\"alignnone wp-image-24198\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Wrap-Call-Chain.gif\" alt=\"Wrap Call Chains\" width=\"1083\" height=\"574\" \/><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Rename a file when renaming a class<\/strong><\/span><\/div>\n<div>You can now rename a file when renaming an interface, enum or class.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24202 size-full\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Rename-File-When-Renaming-Class.png\" alt=\"Rename File when Renaming a Class\" width=\"1100\" height=\"288\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Rename-File-When-Renaming-Class.png 1100w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Rename-File-When-Renaming-Class-300x79.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Rename-File-When-Renaming-Class-768x201.png 768w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Rename-File-When-Renaming-Class-1024x268.png 1024w\" sizes=\"(max-width: 1100px) 100vw, 1100px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Sort usings is back!<\/strong><\/span><\/div>\n<div>We brought\u202fback the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/sort-usings\">sort\u202fusings<\/a> command separate from\u202fthe\u202fRemove and Sort Usings\u202fcommand.\u202fYou can now\u202ffind the\u202fSort\u202fUsings\u202fcommand in\u202fEdit &gt; IntelliSense.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24201 size-full\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Sort-Usings-Is-Back.png\" alt=\"Sort Usings\" width=\"1063\" height=\"690\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Sort-Usings-Is-Back.png 1063w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Sort-Usings-Is-Back-300x195.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Sort-Usings-Is-Back-768x499.png 768w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/Sort-Usings-Is-Back-1024x665.png 1024w\" sizes=\"(max-width: 1063px) 100vw, 1063px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Convert a switch statement to a switch expression<\/strong><\/span><\/div>\n<div>You can now <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/convert-switch-statement-to-switch-expression\">convert\u202fa\u202fswitch statement to\u202fa\u202fswitch expression<\/a>.\u202fIn your\u202fproject file make sure the\u202flanguage version is set to preview\u202fsince\u202f<a href=\"https:\/\/docs.microsoft.com\/dotnet\/csharp\/whats-new\/csharp-8#switch-expressions\">switch expressions<\/a>\u202fare a new C# 8.0 feature.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24204\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/switch.png\" alt=\"Convert a Switch Statement to a Switch Expression\" width=\"1058\" height=\"559\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/switch.png 833w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/switch-300x158.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/switch-768x406.png 768w\" sizes=\"(max-width: 1058px) 100vw, 1058px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Generate a parameter<\/strong><\/span><\/div>\n<div>You can now <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/generate-parameter\">generate\u202fa parameter<\/a>\u202fas a code fix.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24207\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/generate.png\" alt=\"Generate Parameter\" width=\"1055\" height=\"340\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/generate.png 807w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/generate-300x97.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/generate-768x247.png 768w\" sizes=\"(max-width: 1055px) 100vw, 1055px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<div><strong><span style=\"font-size: 14pt;\">Toggle comment\/uncomment<\/span><\/strong><\/div>\n<div><a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/csharp-developer-productivity\">Toggle single line comment\/uncomment<\/a> is now available through the keyboard shortcut\u202f(<strong>Ctrl + K, \/<\/strong>). This command will add or remove a single line comment depending on whether your selection is already commented.<\/div>\n<\/div>\n<div>\n<div><a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/csharp-developer-productivity\">Toggle block\u202fcomment\/uncomment<\/a> is now available through the keyboard shortcut\u202f(<strong>Ctrl + Shift + \/<\/strong>). This\u202fcommand will add\u202for\u202fremove block comments depending on\u202fwhat\u202fyou have\u202fselected.<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24209\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/block.png\" alt=\"Toggle Block Comment\/Uncomment\" width=\"553\" height=\"182\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/block.png 468w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/block-300x99.png 300w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Move type to namespace<\/strong><\/span><\/div>\n<div>You can now use a refactoring dialog to <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/move-type-to-namespace\">move type to namespace<\/a> or folder.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24211\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move.png\" alt=\"Move Type to Namespace\" width=\"617\" height=\"236\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move.png 549w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move-300x115.png 300w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/div>\n<div><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24212\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move-to-namespace-dialog.png\" alt=\"Move Type to Namespace Dialog\" width=\"572\" height=\"297\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move-to-namespace-dialog.png 407w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/move-to-namespace-dialog-300x156.png 300w\" sizes=\"(max-width: 572px) 100vw, 572px\" \/><\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Split or merge if statements<\/strong><\/span><\/div>\n<div>We now have a code fix for <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/reference\/split-or-merge-if-statement\">split\/merge if statements<\/a>.<\/div>\n<div><img decoding=\"async\" class=\"alignnone size-full wp-image-24213\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/split.png\" alt=\"Split or Merge If Statements\" width=\"950\" height=\"303\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/split.png 950w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/split-300x96.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/split-768x245.png 768w\" sizes=\"(max-width: 950px) 100vw, 950px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>\n<div><span style=\"font-size: 14pt;\"><strong>Wrap binary expressions<\/strong><\/span><\/div>\n<div>We now have a code fix for wrap binary expressions.<\/div>\n<div><img decoding=\"async\" class=\"alignnone wp-image-24215\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/wrap-expression.png\" alt=\"Wrap Binary Expression\" width=\"904\" height=\"248\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/wrap-expression.png 835w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/wrap-expression-300x82.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2029\/08\/wrap-expression-768x211.png 768w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/div>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<h3><span style=\"font-size: 18pt;\"><strong>Get Involved<\/strong><\/span><\/h3>\n<div>\n<div>This was just a sneak peak of what\u2019s new in <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\">Visual Studio 2019 Preview<\/a>, for a complete list see the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/releases\/2019\/release-notes\">release notes<\/a> and feel free to provide feedback on Developer Community, and using the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio\">Report a Problem<\/a> tool in Visual Studio.<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The .NET team is constantly thinking of new ways to make developers more productive. We&#8217;ve been working hard over the past year to take the feedback you&#8217;ve sent us and turn it into tools that you want! In this post I\u2019ll cover some of the latest productivity features available in\u00a0Visual Studio 2019 Preview. Code Fixes [&hellip;]<\/p>\n","protected":false},"author":5818,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[4],"class_list":["post-24195","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-net"],"acf":[],"blog_post_summary":"<p>The .NET team is constantly thinking of new ways to make developers more productive. We&#8217;ve been working hard over the past year to take the feedback you&#8217;ve sent us and turn it into tools that you want! In this post I\u2019ll cover some of the latest productivity features available in\u00a0Visual Studio 2019 Preview. Code Fixes [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/5818"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=24195"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24195\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=24195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=24195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=24195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}