Skip to content

Document Simplified Names on Anonymous Types page #33322

@KyleMit

Description

@KyleMit

It would be helpful to see the official feature / syntax / name / description of using the simplified anonymous type syntax

For example the following anonymous object syntax:

var firstName = "Kyle";
var lastName = "Mit";
var person = { firstName, lastName };

Which is essentially equivalent to:

var person = { firstName = "Kyle", lastName = "Mit"};

Not sure what this feature is called: implicit property names / inferred names / simple names?

For Tuples, this is called Infer tuple names (aka. tuple projection initializers) and came out in C# 7.1 and referenced on the Tuple types page


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 477082

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.dotnet-csharp/svcfundamentals/subsvcin-prThis issue will be closed (fixed) by an active pull request.okr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions