代码检查:多余的 'base.' 限定符调
如果移除 base. 限定符或用 this. 替换它,仍然能够解析到相同的成员,则该检查会报告此问题。 在这种情况下,显式 base 限定符是多余的,会让代码更冗长。
class Base
{
protected string text = "";
}
class Derived : Base
{
int GetLength()
{
return base.text.Length;
}
}
class Base
{
protected string text = "";
}
class Derived : Base
{
int GetLength()
{
return text.Length;
}
}
如果 代码语法风格要求使用显式实例限定符,则快速修复可以将 base. 替换为 this.。
2026年 5月 8日