I know that methods declared with void
does not return anything.
But it seems that in C#, void
is more than just a keyword, but a real type.
void
is an alias for System.Void
, like int
that is for System.Int32
.
Why am I not allowed to use that type? It does not make any sense, but these are just some thoughts about the logic.
Neither
var nothing = new System.Void();
(which says I should use void
(Not an alias?))
nor
var nothing = new void();
compiles.
It is also not possible to use something like that:
void GiveMeNothing() { }
void GiveMeNothingAgain()
{
return GiveMeNothing();
}
So what's the point with System.Void
?
void GiveMeNothing() { }
works good in Mono.NET 3.5... – Handcraftedvoid
ofGiveMeNothing
in an othervoid
-returning method? – Casimirvoid
is just an indicator that function returns nothing at all. – HandcraftedIEnumerable<System.Void>
It's just a bunch of nothing – Kicksorter