Add attributes to multiple physical lines of code

Hi all,

Can anyone advise me how I can add, say, two new Attributes, but have them appear on different physical lines of code?

This example will generate two attributes, but they'll be added to the same line of code in the source code:

IAttribute attribute1 = {create an attribute};
IAttribute attribute2 = {create another attribute};



IClassDeclaration classDeclaration;
...
classDeclaration.AddAttributeAfter(attribute1, null);
classDeclaration.AddAttributeAfter(attribute2, null);


The resulting code is something like this:

[MyAttribute, MyAttribute]
public class MyClass {}


I would like the code to be formatted like this:

[MyAttribute]
[MyAttribute]
public class MyClass {}


Kind regards
Ben

1 comment

Hi, no, this is impossible. The appearance of the attributes is governed by the settings - there's a setting which controls whether attributes get lumped together or appear one per line.

0

Please sign in to leave a comment.