0

C# 3 introduced object initializers.

var person = new Person () {
    FirstName = "John",
    LastName = "Doe",
};

When I set multiple properties, they're assigned in the order listed, both in .NET and Mono. Is it only by luck, or is this by standard and can I rely on this behaviour ?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85
  • 1
    Yes, see http://stackoverflow.com/questions/495616/order-of-operations-using-object-initializer-syntax – Dennisch Feb 11 '13 at 20:11
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Feb 11 '13 at 20:21

0 Answers0