Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Catch clauses cannot follow the general catch clause of a try statement
A catch
block that does not take any parameters must be the last in a series of catch
blocks. For more information on exceptions, see Exceptions and Exception Handling.
Example
The following sample generates CS1017:
// CS1017.cs
using System;
namespace x
{
public class b : Exception
{
}
public class a
{
public static void Main()
{
try
{
}
catch // CS1017, must be last catch
{
}
catch(b)
{
throw;
}
}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.