0

In C# XML comments, we have the <exception> tag to say that a method throws a particular type of exception.

What is the best way to tell the library users that a method does not throw any (expected) exceptions? Is the absense of <exception> tags enough? Or is there a special XML tag that I missed?

2
  • 3
    I'd just use the "remarks" for this: /// <remarks>This method does not throw any exceptions.</remarks> (of course, you can't really guarantee that a method doesn't throw ANY exception because of things like out-of-memory and out-of-stack-space) Commented Aug 8, 2022 at 16:01
  • No special tag I can think of. An absence could be enough, but I would think you'd have to be very consistent about it across your code base for it to actually be meaningful. I only say that because I've only ever seen that tag be used very sporadically, personally. I would never assume a lack of that tag means no exceptions are thrown. Commented Aug 8, 2022 at 16:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.