dotnet / dotnet/vblang

[Proposal] Create new objects from anonymous types

Open
#577 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

I suggest this general solution to the issue in #576:
Suppose we have this anonymous type:
`Dim a = New With {.x = 1, .y = 2}`
I suggest to allow reusing it like this:
`Dim b = New TypeOf(a) With {.x = 3, .y = 4}`
And in a short form, using a virtual constructor:
`Dim c = New TypeOf(a)(3, 4)`
VB can supstitute `TypeOf(a)` with the actual temp type used for the anonymous type, and convert the constructor to filed assignment statements, in the same order they defined in the type.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.