Search code examples
c#editorconfig

Formatting attributes on the same line in editor config


Is there any option on editor config to format attributes like in "Example1" instead of "Example2"?

The example below is C#.


Solution

  • AFAIK there is no such option for "vanilla" .editorconfig, but if you are using Rider/ReSharper then there are quite a lot of options to setup arrangement of attributes. For example, you can use the following:

    [*.cs]
    place_attribute_on_same_line = false
    

    Or to target specifically fields:

    [*.cs]
    csharp_place_field_attribute_on_same_line = false