[Proposal] `?=` operator: New If Nothing
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
I have a param `reqAttrs As List(Of String)` which I need to initialize it if nothing like this:
```VB.NET
reqAttrs = If(reqAttrs, New List(Of String))
```
I hope this can be shorten using null coalesce like this
```VB.NET
reqAttrs? = New List(Of String)
```
And I hope we don't mention the type and generic param since they are well known, I saw this proposal once, here or in C# repo and I hope it is done for all initializations:
```VB.NET
reqAttrs? = New
```
Or format it as:
```VB.NET
reqAttrs ?= New
```
Compare this to:
```VB.NET
reqAttrs = If(reqAttrs, New List(Of String))
```
If someone fears that `?=` is too symbolic and less readable, the alternative verbose VB one can be:
Or format it as:
```VB.NET
reqAttrs = New If Nothing
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.