This code will compile successfully (as part of a method):
 
try 
{ 
     Console.WriteLine("TRY"); 
     throw new Exception("EXCEPTION"); 
} 
catch (Exception) 
{ 
      Console.WriteLine("CATCH"); 
}
 
Explanation
It is not necessary to indicate the identifier of exception in the catch block.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты