ReSharper 2024.1 Help

Code inspection: Redundant empty argument list on object creation expression

In C#, when you create a new instance of a class and immediately initialize it using a collection initializer (the part in the curly braces), you don't need to include the parentheses after the class name.

Therefore ReSharper suggests removing the redundant parentheses to make your code cleaner and more concise.

var words = new List<string>() {"one", "two"};
var words = new List<string> {"one", "two"};
Last modified: 08 April 2024