代码检查:冗余的 '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日