ReSharper 2019.3 Help

Code Inspection: Redundant comma in array/object/collection/anonymous type initializer

Currently, ReSharper suggests removing optional trailing commas for the sake of conciseness, and this behavior is not configurable. We are going to introduce a configurable code syntax style for trailing commas in the coming versions — here is the tracking issue.

If you prefer having trailing commas in multi-line initializers, just disable this inspection: press Alt+Enter and choose Inspection: "Redundant comma in array/object/collection/anonymous type initializer" | Configure inspection severity | Do not show.

var myArray = new[] { "one", "two", // trailing comma after the last expression is optional "three", }; var myObject = new MyClass { A = 10, B = 20, // trailing comma after the last property initializer is optional C = 30, };
Last modified: 24 February 2020