C#XML注释重用
我正在编写一个C#类库,其中包含许多具有函数的类,它们的功能几乎相同。我需要提供关于每个类中函数参数的XML注释,这些注释非常详细,但在大多数情况下是相同的。有没有一种方法可以重用XML注释,这样我就不必在程序集中重复这些XML参数定义 以下是我的课程示例:C#XML注释重用,c#,xml-comments,C#,Xml Comments,我正在编写一个C#类库,其中包含许多具有函数的类,它们的功能几乎相同。我需要提供关于每个类中函数参数的XML注释,这些注释非常详细,但在大多数情况下是相同的。有没有一种方法可以重用XML注释,这样我就不必在程序集中重复这些XML参数定义 以下是我的课程示例: public class IsodoseControl : TestModule { /// <summary> /// Verify a control on Isodose dialog /// &l
public class IsodoseControl : TestModule
{
/// <summary>
/// Verify a control on Isodose dialog
/// </summary>
/// <param name="args"> **<-- WHAT I DON'T WANT TO KEEP REPEATING**
/// Arguments: [Property, Condition, Expected Value, Tolerance]
/// Properties: STATE, VALUE, LABEL
/// Conditions: Exists, DoesNotExist, IsEnabled, IsDisabled, ...
/// Expected Value (optional): blah blah
/// Tolerance (optional): blah blah blah
/// </param>
public VerifResult VerifyIsodoseControl(string[] args)
{
...
}
}
public class BeamControl : TestModule
{
/// <summary>
/// Verify a control on Beam dialog
/// </summary>
/// <param name="args"> **<-- WHAT I DON'T WANT TO KEEP REPEATING**
/// Arguments: [Property, Condition, Expected Value, Tolerance]
/// Properties: STATE, VALUE, LABEL
/// Conditions: Exists, DoesNotExist, IsEnabled, IsDisabled, ...
/// Expected Value (optional): blah blah
/// Tolerance (optional): blah blah blah
/// </param>
public VerifResult VerifyBeamControl(string[] args)
{
...
}
}
公共类IsodoseControl:TestModule
{
///
///验证“等剂量”对话框上的控件
///
///***我认为Visual Studio中没有任何东西可以帮助您。它有一个标记,可以让您继承整个xml注释块,或者您也可以定义一个包含参数文本的sandcastle,它可以让您编写如下内容
/// <summary>
/// Verify a control on Beam dialog
/// </summary>
/// <param name="args"><token>CommonParamInfo</token></param>
/// (...)
//
///验证“梁上的控件”对话框
///
///CommonParamInfo
/// (...)
Sandcastle是专门为API文档设计的,但可能不适合您的情况。该标记允许您引用另一个文件中的注释,该文件描述源代码中的类型和成员
您可以使用标记从两个类引用相同的文件
//
类一类{}
///
使用相同的功能{}初始化不同的类
此链接提供了一些使用以下内容的示例:
/// <include file='comments.xml' path='MyDocs/MyMembers[@name="test"]/*' />
class OneClass {}
/// <include file='comments.xml' path='MyDocs/MyMembers[@name="test"]/*' />
class DifferentClassWithTheSameFunctionality {}