Language Feature Request: Smart method declarations

I haven’t taken much of a look a the .NET Roadmap so I have a naive request: If I, now, don’t have to declare the type when declaring the variable name when using var (C#) or Option Infer (VB.NET), it would be nice to also have return type assumed to be void (C#) or Sub (VB.NET) unless I specify otherwise.

Original Syntax
C#

public void DoSomething() { … }

public int GetValue() { return 1; }

VB.NET

Public Sub DoSomething()
End Sub

Public Function GetValue() As Integer
    Return 1
End Function

Proposed New Syntax
C#

public DoSomething() { … }

public int GetValue() { return 1; }

VB.NET

Public Method DoSomething()
End Method

Public Method GetValue() As Integer
    Return 1
End Method
Advertisements

One thought on “Language Feature Request: Smart method declarations

  1. on a similar notei would like to see an enum that can be used as an int with out having to use boxing to convert value enum to reference int

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s