Accessing properties from object initializer [duplicate]
问题 This question already has answers here : C# Object Initialiser - Reference to the new instance (4 answers) Closed last year . I have the following Person class class Person { public string FirstName { get; set; } public string LastName { get; set; } public string FullName { get { return FirstName + " " + LastName; } } public IEnumerable<Person> Children { get; set; } } I could initialize it like this: Person p = new Person() { FirstName = "John", LastName = "Doe" }; But is it possible to