NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0160

A previous catch clause already catches all exceptions of this or a super type ('type')

A series of catch statements needs to be in decreasing order of derivation. For example, the most derived objects have to appear first.

The following sample generates CS0160:

using System;
public class b : Exception {
}

public class a {
   public static void Main() {
      try {
      }

      catch(Exception) {   // second most derived, should be second catch
      }

      catch(b) {   // CS0160 most derived, should be first catch
      }

      catch {   // must be last catch
      }
   }
}

See Also

Exception Handling Statements