Can remove type qualifier
CodeRush Classic shows the Can remove type qualifier code issue if the current type qualifier includes a namespace information, provided that the using section does not include the appropriate namespace.
Note
The code issue is unavailable if adding the namespace reference to the using section would cause the “Ambiguous references” error.
#Fix
Shorten the type qualifier to a type name and add the appropriate namespace reference to the using section.
#Purpose
Shows the type qualifiers that can be shortened to make code more readable.
#Example
using System.Collections.Generic;
using System;
namespace MyNamespace
{
class MyClass
{
private List<System.Drawing.Point> _Points;
public void AddPoint(int x, int y)
{
if (_Points == null)
_Points = new List<System.Drawing.Point>();
_Points.Add(new │System.Drawing.Point(x, y));
}
}
}
Fix:
using System.Collections.Generic;
using System;
using System.Drawing;
namespace MyNamespace
{
class MyClass
{
private List<Point> _Points;
public void AddPoint(int x, int y)
{
if (_Points == null)
_Points = new List<Point>();
_Points.Add(new Point(x, y));
}
}
}