ReSharper
 
Get ReSharper
You are viewing the documentation for an earlier version of ReSharper.

Code Inspection: Use preferred style for trailing comma when last element is not followed by a new line

Last modified: 21 July 2022

This code inspection checks that trailing commas in single-line declarations with multiple items and similar constructs (object, array, and collection initializers, as well as enums and switch expressions) conform to your code style.

Depending on your preferences, it either detects redundant trailing commas or missing trailing commas.

The preferences are configured on the Code Editing | C# | Syntax Style page of ReSharper options (Alt+R, O), under Trailing comma.