First, properties cannot be read-only with the readonly keyword. They can only have non-public customization methods.
Secondly, there is no such thing as a “braces constructor”. This is just syntactic sugar (shortcut) for a set of statements like this:
Person p = new Person(); // standard parameterless constructor is called p.FirstName = "Bob"; p.LastName = "Smith";
Note that you can also use the constructor with parameters:
new Person(1, 2, 3) { FirstName = "Bob", LastName = "Smith" }
translates as:
Person p = new Person(1, 2, 3); p.FirstName = "Bob"; p.LastName = "Smith";
Regarding reflection: To build a new instance and initialize it in the same way as in the example new Person { FirstName = "Bob", LastName = "Smith" } , you should:
source share