I know it is a foolish question to ask but after reading the very first answer of Mr. Matteo Italia If void() does not return a value, why do we use it?, I have performed this small experiment in C# 4.0
class Program
{
static void Main(string[] args)
{
var x = (int)5; // worked as expected
var x1 = (void)10; // Error 'void' cannot be used in this context
}
}
Why?