JetBrains Rider 2023.3 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 JetBrains Rider 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: 03 August 2023