C#


CSHARP.ID.CASE.METHOD : Method Names Differ Only in Case (C#)

要旨

A method has a name identical to another in a superclass, up to capitalization.

C# classes can be extended and methods overridden. Sometimes, it is possible that methods are redefined in a way that seems an overriding but is actually the definition of another, distinct method. This is often cause of ambiguities and bugs. Moreover, fields in C# cannot be overridden and a subclass may add a synonym field of a superclass: the class ends up having two fields with the same name. This is often a source of ambiguities and might lead programmers to think that the field is actually overridden at all uses, while distinct synonym fields are used at different program points.

This checker finds ambiguities and bugs in the extension of classes, method overriding and fields redefinition.

プロパティ

クラス名 Method Names Differ Only in Case (C#)
日本語クラス名 Method Names Differ Only in Case (C#)
クラス分類 信頼性 (reliability)
ニーモニック CSHARP.ID.CASE.METHOD
カテゴリー
CWE CWE:628 Function Call with Incorrectly Specified Arguments
対応言語 C# で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Method Names Differ Only in Case (C#)"

解決法

Check if a method redefinition should rather be an overriding. Check if a synonym field, already defined in a superclass, should be removed or renamed.

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。