docfx生成文档试想让这个类不生成 字段和方法的文档
要让某个类不生成字段和方法的文档,可以使用DocFX中的特性来控制文档生成的行为。以下是一种方法:
在需要忽略的字段和方法上使用[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]特性。这个特性告诉编译器在文档生成中忽略这些成员。
例如,假设有一个名为MyClass的类,其中有一个字段myField和一个方法MyMethod,你可以像下面这样使用特性来阻止文档生成:
public class MyClass
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public string myField;
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public void MyMethod()
{
// 方法实现
}
}
这样,在生成文档时,myField和MyMethod将被忽略。
希望这可以帮助到你
原文地址: http://www.cveoy.top/t/topic/iSSg 著作权归作者所有。请勿转载和采集!