<example> 文档标记

借助 <example> 标记,可以指定如何使用方法或其他库成员的示例。 通常,使用这个标记也会涉及到 <code> 标记。

语法

/// <example>description</example>

参数

description
代码示例的说明。

备注

使用 /doc 进行编译以将文档注释处理到文件中。

示例

// 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;
   }
};

另请参阅

XML 文档