views:

299

answers:

3

Is this the actual type methods without a return value return?

If so, where is the distinction that "nothing" is returned made?

+7  A: 

I'm not sure exactly what you're looking for. There is a System.Void and a keyword 'void'.

The keyword is used for reasons stated by your definition of the type. The type is used in reflection when you ask what 'type' a method info will return.

Marc
+4  A: 

This value type is actually for reflection use. Suppose you want to query the return type of a method. What value would you get back? This is what System.Void is for.

But the documentation already says:

The Void structure is used in the System.Reflection namespace, but is rarely useful in a typical application. The Void structure has no members other than the ones all types inherit from the Object class.

Joey
+2  A: 

The method does not return anything; no return value appears on the stack (as opposed to a null value, all zeros, a reference to System.Void, etc.)

The System.Void type is just a placeholder for the reflection APIs so that reflection has a convenient way to tell you that the method does not return a value.

binarycoder