1

I am currently moving from Java to C#. While connecting the dots on comparison between the two I came across Exceptions.

As in Java, you must either handle an exception or mark the method as one that may throw it using the throws keyword. I have not been able to find any such way of marking methods in C#.

void show() throws Exception
{
    throw new Exception("my.own.Exception");
}

So the question is simple how can I achieve such java like exception throwing in C#, that is what would be equivalent to the above code in C#.

BoJack
  • 19
  • 2

0 Answers0