Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 1.27 KB

example-visual-cpp.md

File metadata and controls

57 lines (45 loc) · 1.27 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: XML documentation tag <example>
<example> (C++ documentation comments)
12/03/2021
<example>
<example> C++ XML tag
example C++ XML tag
c821aaa7-7ea7-4bee-9922-6705ad57f877

<example> documentation tag

The <example> tag lets you specify an example of how to use a method or other library member. Commonly, use of this tag would also involve the <code> tag.

Syntax

/// <example>description</example>

Parameters

description
A description of the code sample.

Remarks

Compile with /doc to process documentation comments to a file.

Example

// xml_example_tag.cpp
// compile with: /clr /doc /LD
// post-build command: xdcmake xml_example_tag.dll

/// Text for class MyClass.
public ref class MyClass {
public:
   /// <summary>
   /// GetZero method
   /// </summary>
   /// <example> This sample shows how to call the GetZero method.
   /// <code>
   /// int main()
   /// {
   ///    return GetZero();
   /// }
   /// </code>
   /// </example>
   static int GetZero() {
      return 0;
   }
};

See also

XML documentation