static void Main(string[] args)
{
try
{
Console.WriteLine("No Error");
}
catch (DataException) /*why no compilation error in this line?*/
{
Console.WriteLine("Error....");
}
Console.ReadKey();
}
The code is compiling without any error. I do not understand why the first line of the catch block is not giving any compilation error -
catch (DataException)
DataException parameter of the catch block is a class, and it should have a variable next to it such as -
catch (DataException d)
Can someone explain the above behavior?
d
– Biagio