<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mark Arteaga</title>
    <description>The latest articles on Forem by Mark Arteaga (@marteaga).</description>
    <link>https://forem.com/marteaga</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F538102%2Fa1309a5e-1ad3-4207-87f0-73a752d561eb.jpeg</url>
      <title>Forem: Mark Arteaga</title>
      <link>https://forem.com/marteaga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/marteaga"/>
    <language>en</language>
    <item>
      <title>Quick Tip - Remove Unused Using References in Visual Studio</title>
      <dc:creator>Mark Arteaga</dc:creator>
      <pubDate>Sun, 01 Aug 2021 21:05:30 +0000</pubDate>
      <link>https://forem.com/redbit/quick-tip-remove-unused-using-references-in-visual-studio-2ffj</link>
      <guid>https://forem.com/redbit/quick-tip-remove-unused-using-references-in-visual-studio-2ffj</guid>
      <description>&lt;p&gt;When working on a C# project be it Xamarin, ASP.NET Core etc within Visual Studio, developers sometimes forget to clean up &lt;code&gt;using statements&lt;/code&gt;. Now Visual Studio does a good job of showing you visually unused using statements as follows &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z4Cxgamn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjptu7dntwgkpscv3le7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z4Cxgamn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjptu7dntwgkpscv3le7.png" alt="Screenshot 2021-08-01 150011"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you are working on bigger projects (in my current case, working on a project with 774 files), sometimes as a developer we forget to clean up our using statements as we go through code refactoring. &lt;/p&gt;

&lt;p&gt;Well, thanks to Visual Studio, we can quickly clean up &lt;code&gt;using statements&lt;/code&gt; in a file in two ways.&lt;/p&gt;

&lt;p&gt;First is putting your cursor on one of the grayed out lines and clicking the light bulb, then clicking "Remove Unnecessary Usings". (NOTE: The shortcut key for this is &lt;code&gt;CTRL-.&lt;/code&gt;) &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J7bwtWMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r89ovwkjet67twb5tqbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J7bwtWMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r89ovwkjet67twb5tqbd.png" alt="Screenshot 2021-08-01 150730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the action is executed the references will be cleaned up. But what happens when you have 700+ files? &lt;/p&gt;

&lt;p&gt;Well if you noticed in the dialog, there is a section at the bottom that says &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sE4nTuQ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0m2hyymam3f75pa5tsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sE4nTuQ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0m2hyymam3f75pa5tsn.png" alt="Screenshot 2021-08-01 151508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here you can see the options are &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Document&lt;/li&gt;
&lt;li&gt;Project&lt;/li&gt;
&lt;li&gt;Solution&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now it's pretty obvious, what the options are, but in all my years of using Visual Studio, I have not noticed these options and no one wants to go through 700+ files to clean them up! &lt;/p&gt;

&lt;p&gt;This is what the dialog looks like when you click &lt;code&gt;Solution&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zpgJuBT7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dcoeil4fnhcupij5q1tx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zpgJuBT7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dcoeil4fnhcupij5q1tx.png" alt="Screenshot 2021-08-01 164316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So I don't know if this is a Visual Studio 2019 feature or if it's always been there. But this makes it a little more 'enjoyable' to go in and clean up lines of code that are no longer required in your source code!&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>visualstudio</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
