C# order of Attributes

kesiya abraham 1 Reputation point Microsoft Employee
2021-12-14T10:00:23.137+00:00

Hi Team,

We would like to know the order of attributes when we retrieved through reflection is always the same or how the order of attributes is determined by the compiler.

[SomeAttribute("value1")]
[SomeAttribute("value2")]
[SomeAttribute("value3")]
[SomeAttribute("value4")]
public void MethodSample()
{
}

In this example, can we expect the order of SomeAtttribute always be the same through reflection?

Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-12-14T11:30:50.687+00:00

    There is no significance in the order of attributes.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.