• CodexArcanum@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    Wildly, in C# you can do either and it has different results. I believe a bare throw doesn’t append to the stack trace, it keeps the original trace intact, while throw e updates the stack trace (stored on the exception object) with the catch and rethrow.

    In C#, you can only throw objects whose class derives from Exception.