<see>
文档标记
<see>
标记可用于从文本内指定链接。 使用 <seealso>
指示想要在“另请参阅”部分中显示的文本。
语法
/// <see cref="member"/>
参数
member
对可从当前编译环境调用的成员或字段的引用。 将名称括在单引号或双引号中。
编译器检查是否存在给定的码位元素,并将 member
解析为输出 XML 中的元素名称。 如果编译器没有找到 member
,它会发出警告。
注解
使用 /doc
进行编译可以将文档注释处理到文件中。
有关使用 <see>
的示例,请参阅 <summary>
。
MSVC 编译器将尝试通过文档注释在一次处理中解析 cref
引用。 如果编译器使用 C++ 查找规则时找不到符号,它会将引用标记为未解析。 有关详细信息,请参阅 <seealso>
。
示例
以下示例显示了如何对泛型类型进行 cref
引用,以便编译器解析该引用。
// xml_see_cref_example.cpp
// compile with: /LD /clr /doc
// the following cref shows how to specify the reference, such that,
// the compiler will resolve the reference
/// <see cref="C{T}">
/// </see>
ref class A {};
// the following cref shows another way to specify the reference,
// such that, the compiler will resolve the reference
/// <see cref="C < T >"/>
// the following cref shows how to hard-code the reference
/// <see cref="T:C`1">
/// </see>
ref class B {};
/// <see cref="A">
/// </see>
/// <typeparam name="T"></typeparam>
generic<class T>
ref class C {};
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈