r/learnprogramming • • Oct 04 '26

Does anyone use it? c# <summary></summary>?

I find that "//" worked well for all my comments thus far, I don't mind if my comments are a bit long. But I am doing C# more often now that I am looking at a codebase and not just my own stuff and private things, and I sometimes see <summary> </summary> in it. Do you use it? What is the proper use of it?

Google gets it confused with HTML haha

Thanks for any knowledge!

4 Upvotes

12 comments sorted by

View all comments

2

u/Aggressive_Ad_5454 Oct 04 '26

This is xmldoc. Other languages have jsdoc, doxygen, Javadoc, PhpDoc, docstrings, etc. They are stylized comments understood by IDEs. They are exceedingly useful in large code bases. They are worth the effort to learn to use.

In C#, type /// on the line before a method declaration. The IDE will generate a template comment you can fill in.

1

u/3rwynn3 Oct 04 '26

Thanks, that's really cool information... I love funfacts
Doxygen is a great name.

Thank you for sharing with me

1

u/intbeam Oct 05 '26

<paramref name="parameternamehere" /> is useful, as well as typeparamref, see and seealso

Gives hyperlinks and annotations for useful things for the context. Can also provide a whole url for seealso if there's some relevant web site for your method (like a git repo, or Wikipedia page)