Skip to main content

Redundant type qualifier

In This Article

CodeRush Classic shows the Redundant type qualifier code issue if a type qualifier includes namespace information, provided that the using section already includes the appropriate namespace.

#Fix

Remove the redundant type qualifier.

#Purpose

Highlights the type qualifiers, which can be removed to improve code readability.

#Example

using System;
using System.Drawing;

namespace ConsoleTest
{
    public class MyClass
    {
        public System.Drawing.Rectangle CreateSquare(int sideLength, Point topLeft)
        {
            return new System.Drawing.Rectangle(topLeft.X, 
                       topLeft.Y, 
                       sideLength, 
                       sideLength);
        }
    }
}

Fix:

using System;
using System.Drawing;

namespace ConsoleTest
{
    public class MyClass
    {
        public Rectangle CreateSquare(int sideLength, Point topLeft)
        {
            return new Rectangle(topLeft.X, 
                       topLeft.Y, 
                       sideLength, 
                       sideLength);
        }
    }
}