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

user677607 picture user677607 · Apr 20, 2011 · Viewed 70.2k times · Source

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!

Answer

Dilum Ranatunga picture Dilum Ranatunga · Apr 20, 2011

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>