dotnet / dotnet/vblang

New Feature, VisualBasic With Keyword Syntax for property mapping

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

Description

Hi, currently, if we want to get or set property value to another object, 7 lines of code must be used,

Current:
```vbnet

Dim _value As

Public Property Value As String
Get
Return _value.Label
End Get
Set
_value.Label = value
End Set
```

This is not so convenient and not a brief code, and I think this situation can be simplify with the VisualBasic ``With`` keyword

```vbnet
Dim _value As

' maps both get and set
Public Property Value As String With _value.Label
' maps readonly
Public ReadOnly Property Value2 As String With _value.Label
' maps writeonly
Public WriteOnly Property Value3 As String With _value.Label
```

Or with two lines of code syntax

```vbnet
Dim _value As

' maps both get and set
Public Property Value As String
With _value.Label

' maps readonly
Public ReadOnly Property Value2 As String
With _value.Label

' maps writeonly
Public WriteOnly Property Value3 As String
With _value.Label
```

Which it means the ``Value`` property its value was mapped to the property of another object ``_value.Label``, this will makes the code more beautiful and briefly.

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.