Search code examples
c#exceptionthrow

What is "throw"


Can anyone please explain me use of throw in exception handling? What happens when i throw an exception?


Solution

  • It means to "cause" an exception. When you "throw" an exception you are saying "something has gone wrong, here's some details".

    You can then "catch" a "thrown" exception to allow your program to degrade gracefully instead of erroring and dying.