Ticket T432389
Visible to All Users

Simplify name, remove unneccessary cast and this qualifier for all occurrences in a document

created 8 years ago

At times you get a file that is littered with unnecessary this-qualifiers, casts and namespace qualifiers.  The refactorings to remove these are available, but there does not appear to be a way to remove all of these at once?  Couldn't find it in the code cleanup, and it would be nice to have a "Remove all" in the refactoring menu itself.

If this is possible in the current version, I would appreciate some information on how to perform this, otherwise consider this a feature request. :)

Show previous comments (3)
DevExpress Support Team 8 years ago

    Peter,

    We have recently released a new CodeRush for Roslyn 16.1.8 version that includes the "Remove Type Qualifier" refactoring.
    It would be great if you can try it out and share your feedback with us. Please refer to the what's new list for more details.

      It does not appear to work very well, using my CodeRush settings anyway.I don't see a refactoring invokable from the context menu that does this, but it seems to be available in the code-cleanup, "Remove reduntant type qualifier". However, consider the following program:

      C#
      using System; namespace ConsoleApplication38 { class Program { System.DateTime dateTime; void Test() { System.DateTime s = DateTime.Now; Console.WriteLine(s); } } }

      When I run CodeCleanup on this using the attached settings, the following is the result:

      C#
      using System; namespace ConsoleApplication38 { internal class Program { private System.DateTime dateTime; private void Test() { System.DateTime s = DateTime.Now; Console.WriteLine(s); } } }

      Note that the redundant "System" qualifier of the DateTime variables are still there.

      DevExpress Support Team 8 years ago

        Hello Peter,

        I've created a separate ticket on your behalf (The "Remove Type Qualifier" refactoring does not work in some scenarios). It has been placed in our processing queue and will be answered shortly.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.