Code inspection: Redundant empty 'with()'
This inspection reports an empty with() element in a C# collection expression. An empty with() does not pass constructor arguments and does not change the collection contents, so it can be removed.
サンプル
using System.Collections.Generic;
List<int> numbers = [with(), 1, 2, 3];
using System.Collections.Generic;
List<int> numbers = [1, 2, 3];
クイックフィックス
Remove the empty with() element from the collection expression.
2026 年 7 月 16 日