0

I would like to rearrange my properties inside a object initializer, by manually defining the new position. I found this Question but the first method only sorts the properties alphabetically, the other uses a different extension method.

new Student { StudentID = 2, Nationality = Nationalities.Austrian, StudentName = "Peter", Age = 21 }

A line like the above, I would like to rearrange using ReSharper or a Built-In Feature to this:

new Student { StudentID = 2, StudentName = "Peter", Age = 21,  Nationality = Nationalities.Austrian }

Is there any possibility to achieve this?

Stan1k
  • 338
  • 2
  • 17
  • How would you define the order? What do you gain by doing this? I don't think there is any way to do this as far as I know. – Piers Myers Jan 20 '21 at 18:40
  • By having a refactoring option, you could be able to do so. For example in ReSharper you can change position of your parameters in the Method. Obviously this approach is really needed, but I thought maybe it's also possible for object initializer. – Stan1k Jan 21 '21 at 16:23

0 Answers0