dotnet / dotnet/vblang

[Proposal] Extension method parameter modifer. eg Me

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

Description

## 'Me' Parameter Specifier for VB
**Proposal**
Allow the usage of 'Me' on the first parameter of a method, to indicate an extension method.

- [ ] Definition
Same semantic usage rules as the attribute ``
Must be on first parameter, and only first parameter.
- [x] Parser Support [Personal PR](https://github.com/dotnet/roslyn/pull/17554)
- [ ] Semantics / Binder Support
- [ ] Synthesis of the method attribute ``
- [ ] Unit Tests
- [ ] Error Messages *(needs reworking)*

**Example**

```vbnet
Public Module Exts
Public Function IsEven(Me Value As Integer) As Boolean
Return Value Mod 2 = 0
End Function

Public Function IsOdd(Me Value As Integer) As Boolean
Return Value Mod 2 = 1
End Function

End Module
```
will be functionally equivalent to have then `` attribute on the method.

```vbnet
Public Module Exts

Public Function IsEven(Value As Integer) As Boolean
Return Value Mod 2 = 0
End Function


Public Function IsOdd(Value As Integer) As Boolean
Return Value Mod 2 = 1
End Function

End Module
```
```vbnet
Public Module Exts

Public Function IsOdd( value As Int32 ) As Boolean
Return ( value Mod 2 ) = 1
End Function
End Module
```
-----------------------------------

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.