JetBrains Rider 2026.2 Help

コードインスペクション: 冗長な空の 'with()'

このインスペクションは、C# コレクション式内の空の with() 要素を報告します。 空の with() はコンストラクター引数を渡さず、コレクションの内容も変更しないため、削除できます。

サンプル

using System.Collections.Generic; List<int> numbers = [with(), 1, 2, 3];
using System.Collections.Generic; List<int> numbers = [1, 2, 3];

クイックフィックス

コレクション式から空の with() 要素を削除します。

2026 年 7 月 17 日