java.lang.Void in C#?
Posted
by user313661
on Stack Overflow
See other posts from Stack Overflow
or by user313661
Published on 2010-04-10T22:01:01Z
Indexed on
2010/04/10
22:03 UTC
Read the original article
Hit count: 382
Hi,
I am currently working with .Net 2.0 and have an interface whose generic type is used to define a method's return type. Something like
interface IExecutor<T> {
T Execute() { ... }
}
My problem is that some classes that implement this interface do not really need to return anything.
In Java you can use java.lang.Void for this purpose, but after quite a bit of searching I found no equivalent in C#. More generically, I also did not find a good way around this problem. I tried to find how people would do this with delegates, but found nothing either - which makes me believe that the problem is that I suck at searching :)
So what's the best way to solve this? How would you do it?
Thanks!
© Stack Overflow or respective owner