コードインスペクション: 冗長な 'base.' 修飾子
このインスペクションは、 base. 修飾子を削除、または this. に置き換えても同じメンバーになる場合に報告します。 この場合、明示的なベース修飾子は不要であり、コードが冗長になります。
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 年 6 月 12 日