Exception
is unused CS-R1084Exception variable declared in catch
should be used. If you do not wish to use the trapped Exception
's details, consider omitting the variable from the catch
declaration.
try
{
}
catch (ArgumentException e)
{
// `e` is unused
Console.WriteLine("Error description");
}
// Alternative 1: Use the trapped Exception
try
{
}
catch (ArgumentException e)
{
Console.WriteLine(e);
}
// Alternative 2: Remove exception variable from catch declaration
try
{
}
catch (ArgumentException)
{
Console.WriteLine("Error description");
}