dotnet / dotnet/vblang

[Proposal] As New With

Open
#538 5 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

Class-level anonymous type
I want to define something this at a class level:
```
ReadOnly StringConstants = New With {
.First = "One",
.Second = "Two",
.Third = "Three"
}
```

but StringConstants will be of type object because type inference is only allowed locally!

So, I suggest VB.NET allows us to use `As New With {}`:
```
ReadOnly StringConstants As New With {
.First = "One",
.Second = "Two",
.Third = "Three"
}
```

to declare anonymous types out side methods.

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.