Is there a functional difference between the following syntax...
[Foo, Bar]
public class Baz {}
...and this syntax?
[Foo]
[Bar]
public class Baz {}
Assuming each produces identical results when compiled, which is the preferred form?
Is there a functional difference between the following syntax...
[Foo, Bar]
public class Baz {}
...and this syntax?
[Foo]
[Bar]
public class Baz {}
Assuming each produces identical results when compiled, which is the preferred form?
From a readability standpoint separate attributes are preferred.
Think about the case where you are passing some type of parameter
versus
I would also argue, if you could combine them into one, they should be one tag.
I typically stack attributes. But I also mainly use these with WCF where the parameter list can get pretty big.
There is no functional difference. It's a question of convenience and style.
Most often, I tend to see attributes on their own lines as a way to keep them separate and easy to read. It's also nice to be able to use the line comment
//
to remove attributes individually.