You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prompts/csharp-docs.prompt.md
+46-9Lines changed: 46 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,19 +8,56 @@ description: 'Ensure that C# types are documented with XML comments and follow b
8
8
9
9
- Public members should be documented with XML comments.
10
10
- It is encouraged to document internal members as well, especially if they are complex or not self-explanatory.
11
-
- Use `<summary>` for method descriptions. This should be a brief overview of what the method does.
12
-
- Use `<param>`for method parameters.
13
-
- Use `<paramref>` to reference parameters in documentation.
14
-
- Use `<returns>`for method return values.
11
+
12
+
## Guidance for all APIs
13
+
14
+
- Use `<summary>`to provide a brief, one sentence, description of what the type or member does. Start the summary with a present-tense, third-person verb.
15
15
- Use `<remarks>` for additional information, which can include implementation details, usage notes, or any other relevant context.
16
-
- Use `<example>` for usage examples on how to use the member.
17
-
- Use `<exception>` to document exceptions thrown by methods.
18
16
- Use `<see langword>` for language-specific keywords like `null`, `true`, `false`, `int`, `bool`, etc.
17
+
- Use `<c>` for inline code snippets.
18
+
- Use `<example>` for usage examples on how to use the member.
19
+
- Use `<code>` for code blocks. `<code>` tags should be placed within an `<example>` tag. Add the language of the code example using the `language` attribute, for example, `<code language="csharp">`.
19
20
- Use `<see cref>` to reference other types or members inline (in a sentence).
20
21
- Use `<seealso>` for standalone (not in a sentence) references to other types or members in the "See also" section of the online docs.
21
22
- Use `<inheritdoc/>` to inherit documentation from base classes or interfaces.
22
23
- Unless there is major behavior change, in which case you should document the differences.
23
-
- Use `<typeparam>` for type parameters in generic types or methods.
24
+
25
+
## Methods
26
+
27
+
- Use `<param>` to describe method parameters.
28
+
- The description should be a noun phrase that doesn't specify the data type.
29
+
- Begin with an introductory article.
30
+
- If the parameter is a flag enum, start the description with "A bitwise combination of the enumeration values that specifies...".
31
+
- If the parameter is a non-flag enum, start the description with "One of the enumeration values that specifies...".
32
+
- If the parameter is a Boolean, the wording should be of the form "`<see langword="true" />` to ...; otherwise, `<see langword="false" />`.".
33
+
- If the parameter is an "out" parameter, the wording should be of the form "When this method returns, contains .... This parameter is treated as uninitialized.".
34
+
- Use `<paramref>` to reference parameter names in documentation.
35
+
- Use `<typeparam>` to describe type parameters in generic types or methods.
24
36
- Use `<typeparamref>` to reference type parameters in documentation.
25
-
- Use `<c>` for inline code snippets.
26
-
- Use `<code>` for code blocks. `<code>` tags should be placed within an `<example>` tag. Add the language of the code example using the `language` attribute, for example, `<code language="csharp">`.
37
+
- Use `<returns>` to describe what the method returns.
38
+
- The description should be a noun phrase that doesn't specify the data type.
39
+
- Begin with an introductory article.
40
+
- If the return type is Boolean, the wording should be of the form "`<see langword="true" />` if ...; otherwise, `<see langword="false" />`.".
41
+
42
+
## Constructors
43
+
44
+
- The summary wording should be "Initializes a new instance of the <Class> class [or struct].".
45
+
46
+
## Properties
47
+
48
+
- The `<summary>` should start with:
49
+
- "Gets or sets..." for a read-write property.
50
+
- "Gets..." for a read-only property.
51
+
- "Gets [or sets] a value that indicates whether..." for properties that return a Boolean value.
52
+
- Use `<value>` to describe the value of the property.
53
+
- The description should be a noun phrase that doesn't specify the data type.
54
+
- If the property has a default value, add it in a separate sentence, for example, "The default is `<see langword="false" />`".
55
+
- If the value type is Boolean, the wording should be of the form "`<see langword="true" />` if ...; otherwise, `<see langword="false" />`. The default is ...".
56
+
57
+
## Exceptions
58
+
59
+
- Use `<exception cref>` to document exceptions thrown by constructors, properties, indexers, methods, operators, and events.
60
+
- Document all exceptions thrown directly by the member.
61
+
- For exceptions thrown by nested members, document only the exceptions users are most likely to encounter.
62
+
- The description of the exception describes the condition under which it's thrown.
63
+
- Omit "Thrown if ..." or "If ..." at the beginning of the sentence. Just state the condition directly, for example "An error occurred when accessing a Message Queuing API."
0 commit comments