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?

Sergey Slepov
  • 1,861
  • 13
  • 33
  • 3
    I'd just use the "remarks" for this: `/// This method does not throw any exceptions.` (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) – Matthew Watson Aug 08 '22 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. – Broots Waymb Aug 08 '22 at 16:06

0 Answers0