Skip to content

Returns

Maira Wenzel edited this page Apr 24, 2019 · 6 revisions

The Returns section describes the return value of a method or operator. docs.microsoft.com displays a Returns section automatically for methods that return values. Inside the <returns> tag, add a paragraph that describes the return value.

  • Provide a clear description of the return value. Keep the description concise, but provide enough context to make it meaningful.
  • Use wording that is programming language-neutral.
  • In the description, refer to the method's parameters by name if it's helpful. Because the Returns section appears right below the parameters, it's easy for users to refer back to parameter names if they're unclear.
  • In Returns descriptions for overloaded members, differentiate between the overloads if necessary. For example, the return value for the String.Format method that accepts an array of objects is this: "A copy of format in which the format items have been replaced by the string representations of the corresponding objects in the args array." The overload that accepts three objects is differentiated in the return value description as follows: "A copy of format in which the format items have been replaced by the string representations of arg0, arg1, and arg2."
  • Don't include a link to the return value type, because that's added by the build, but you can specify the type in plain text (for example, "a 32-bit signed integer" for a System.Int32 object). For Boolean, enum, and array return types, follow the phrasing guidelines in Returns: Methods.
  • If you need to document multiple return values that cannot be described in a single paragraph, use a table with the headings "Return value" and "Description". Introduce the table with the sentence "One of the following values:".
  • Do not bury important information about the return value in Remarks. Include it in the description, but point to Remarks for a lengthier discussion if necessary.

The guidelines for writing return value descriptions depend on whether you're documenting a method or an operator, and on the type that is returned. Write a description of each return value, using the wording shown in the tables in the following sections.