Closed
Description
From C# ecma spec 12.7.11.3 it is possible to initialize values into a member using a = { }
syntax (note the lack of the new
keyword). By this it's possible to initialize a new object deeply within its properties that may not even make a setter available. This is very interesting and useful, and should be documented here.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: d5121576-832f-dba0-f489-ba17c1891161
- Version Independent ID: 0ffb923c-a49c-ed59-abb6-9618aea5df61
- Content: How to: Initialize Objects by Using an Object Initializer - C# Programming Guide
- Content Source: docs/csharp/programming-guide/classes-and-structs/how-to-initialize-objects-by-using-an-object-initializer.md
- Product: dotnet-csharp
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done