Search code examples
c#visual-studio-2015resharpersettingsusing-statement

How to set some using statements as not redundant even if they are?


Often files when created start with a set of using statements that are common. Sometimes even after fleshing out the class I have no need of a few of the auto-generated using statements. However, removing them can cause problems if they are eventually needed, such as the problems caused by removing using System.Linq; Is there a way to tell Visual Studio / Resharper not to complain that certain using statements are redundant?

Example:

using System;
using System.Collections.Generic; // Don't need but want anyway without an error
using System.Linq; // Don't need but want anyway without an error
using System.Net;
using System.Text; // Don't need but want anyway without an error
using Acceptance.EndToEnd.Helpers;
using Acceptance.EndToEnd.Locators;

Solution

  • ReSharper offers a much better way to do this:

    enter image description here