creating object parameters in {}?
- by RealityDysfunction
I am trying to decode a piece of code from a book:
List<Person> people = new List<Person>()
{
new Person {FirstName="Homer",LastName="Simpson",Age=47},
new Person {FirstName="Marge",LastName="Simpson",Age=45}
};
Person is just a simple class they made, with a bunch of fields: Name, Last Name, etc...
What I don't understand is, don't we send parameters to a constructor of Person in non-curly brackets? I tried replicating this code, but it doesn't seem to fly, any takers?
Thanks for input.