<include> 标记指示将代码文件(*.cs)外部的某 XML 文件中的一部分、作为 XML 文档注释、包含进代码文件来。
<include file='filename' path='tagpath[@name="id"]' />
其中:
所有的类型及成员。
这是除了将文档注释直接置于源代码文件中之外的另一种可选方法。
<include> 标记使用 XML XPath 语法。有关自定义 <include> 使用的方法,请参见 XPath 文档。
以下是一个多文件示例。第一个文件使用 <include>,如下所列:
[C#] /// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test"]/*' /> class Test { public static void Main() { } } /// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test2"]/*' /> class Test2 { public void Test() { } }
第二个文件 xml_include_tag.doc 包含下列文档注释:
<MyDocs> <MyMembers name="test"> <summary> The summary for this type. </summary> </MyMembers> <MyMembers name="test2"> <summary> The summary for this other type. </summary> </MyMembers> </MyDocs>
<?xml version="1.0"?> <doc> <assembly> <name>t2</name> </assembly> <members> <member name="T:Test"> <summary> The summary for this type. </summary> </member> <member name="T:Test2"> <summary> The summary for this other type. </summary> </member> </members> </doc>
NDoc development is hosted by
|
![]() |