dotnet / dotnet/vblang

Expression-bodied members and blocks

Open
#343 15 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 think VB.NET can make use of C# => symbol to write Expression-bodied subs, functions, properties and even blocks. There should be implicit line continuation around the => symbol.

```
Sub Sub1() => MsgBox("Test")

Function Func1(X as integer) As Integer => 2 * X

Dim x as integer
Property Prop2() As Integer
Get => x
Set => x = Value/2
End Property

' or in short:
Property Prop1( ) As Integer <=> x

Property Prop2() As Integer => 100 ' This is a read-only property

Property Prop3() As Integer <= 100 ' This is a write-only property

```

And in blocks:

```For I = 0 To 10 => Console.WriteLine(I)```

```
Function Test(N as Integer) =>
For I = 0 To N => Console.WriteLine(I)

```

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.