Allow void as covariance generic argument #9200
Answered
by
HaloFour
ds1709
asked this question in
Language Ideas
-
Currently in C# public interface IFoo<out T>
{
T DoWork();
}
public sealed class Int32Foo : IFoo<int>
{
public int DoWork()
{
return 0;
}
}
public sealed class VoidFoo : IFoo<void> // not allowed
{
public void DoWork()
{
}
}
// somw kind of workaround
public sealed class ObjectFoo : IFoo<object>
{
public object DoWork()
{
}
} AFAIK, currently in runtime it's supported to return |
Beta Was this translation helpful? Give feedback.
Answered by
HaloFour
Mar 6, 2025
Replies: 1 comment
-
See: #696 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jaredpar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: #696