java.lang.Void in C#?

You're going to have to either just use Object and return null, create your own object to represent void, or just make a separate interface that returns void.

Here's an idea for the second one:

public class Void
{
    public static readonly Void Instance = null; // You don't even need this line
    private Void() {}
}

that way someone can't create an instance of the class. But you have something to represent it. I think this might be the most elegant way of doing what you want.

Also, you might want to make the class sealed as well.

Tags:

C#

Generics