Search code examples
c#.netexceptionframeworksambiguity

The variable 'MyException' is declared but never used in the instance


I need to clear this warning :

try
 {
    // doSomething();
 }
 catch (AmbiguousMatchException MyException)
 {
    // doSomethingElse();
 }

The compiler is telling me : The variable 'My Exception' is declared but never used

How can I fix this.


Solution

  • Try this one,

    try
    {
        doSomething()
    }
    catch (AmbiguousMatchException)
    {
        doSomethingElse()
    }