Search code examples
c#javaexceptionthrowthrows

Is there a throws keyword in C# like in Java?


Possible Duplicate:
how to use Java-style throws keyword in C#?

i have a function where an exception occurs say for example

private void functionName() throws Exception
{
   // some code that might throw an exception
}

thanks!


Solution

  • No, because there are no checked exceptions in C#

    If you are trying to document exceptions that are thrown, use the standard xml documentation

    /// <exception cref="InvalidOperationException">Why it's thrown.</exception>