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.
An object, string, or class type expected
An attempt was made to pass a predefined data type into a catch block. Only data types that derive from System.Exception can be passed into a catch
block. For more information on exceptions, see Exceptions and Exception Handling.
Example
The following sample generates CS1015:
// CS1015.cs
class Sample
{
static void Main()
{
try
{
}
catch(int) // CS1015, int is not derived from System.Exception
{
}
}
}
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.