-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-Language DesignFeature RequestLanguage-C#Resolution-ExternalThe behavior lies outside the functionality covered by this repositoryThe behavior lies outside the functionality covered by this repository
Description
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 called unit 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):
class C {
C _wrapped;
public void M1(int a) {
return _wrapped.M1(a);
}
public int M2(int a) {
return _wrapped.M2(a);
}
public void M3(int a) {
var result = _wrapped.M3(a);
DoSomethingElse();
return result;
}
}
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 to Func<T, void>.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Language DesignFeature RequestLanguage-C#Resolution-ExternalThe behavior lies outside the functionality covered by this repositoryThe behavior lies outside the functionality covered by this repository