-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: void as a first-class citizen #234
Comments
This is not a duplicate of #166, but that issue does contain quite a bit of discussion about this particular issue. |
There has been a few occasions where I wanted to return a void method from inside a void method. It would make for more consistent code to be able to return void. |
What is the relation between |
Then Task will also be equivalent to Task |
I really would love to see this feature in future version of C#. In my case i have a lot of utility 'duplicated' method overloads, one for Action<> and other for Func<,>. |
We are now taking language feature discussion on https://github.com/dotnet/csharplang for C# specific issues, https://github.com/dotnet/vblang for VB-specific features, and https://github.com/dotnet/csharplang for features that affect both languages. |
I don't know if this is possible, but I find that it would often be useful to be allowed to use
void
as a normal type (which I think is commonly calledunit
in functional languages).This means, for example, that delegating methods can look the same whether they return void or not (note that M1 and M2 have syntactically identical definitions):
Especially when doing code generation, this becomes an issue at times.
Bonus points if it would also be possible to treat an
Action<T>
as equivalent toFunc<T, void>
.The text was updated successfully, but these errors were encountered: