コレクションアクセス分析
Besides analyzing values of collection items, ReSharper also analyzes each collection you use as a whole — it warns you when a collection is never filled or modified even if there is read access to this collection:

コレクションが決して読み込まれない場合

すべての標準コレクション型はデフォルトでこの方法で分析されます。 必要に応じて、この分析を IEnumerable から派生したカスタムコレクションにも適用できます。 この場合、コレクションの public メソッド呼び出しがコレクションの内容にどのように影響するかをReSharperに伝える必要があります。 そのためには、コレクション クラスのメソッドに [CollectionAccessAttribute] を付与し、次のいずれかのフラグを指定します: None、 Read、 ModifyExistingContent、 UpdatedContent (最後の 2 つのフラグの違いは、 UpdatedContent が付けられている場合は、その関数でコレクションに新しい要素を追加できることを意味します)。 これを示す簡単な例を以下に挙げます:

2026 年 11 月 6 日