admin管理员组文章数量:1410682
I'm trying to figure out how to generate documentation for partial classes, that exist in the same namespace, but are split across multiple files.
Made up example:
Filename: Payment.cs
namespace OrderProcessing
partial class OrderProcessor
{
public void ProcessPayment()
public void ApplyDiscounts()
public void CalculateTaxes()
public void RefundPayment()
}
Filename: Shipping.cs
namespace OrderProcessing
partial class OrderProcessor
{
public void PrepareShipment()
public void GenerateTrackingNumber()
}
When I build the documentation, all partial classes are merged into one single entry for OrderProcessor, and include all the methods. However, I want to split the documentation so that each file has its own separate section, with each their own mehods.
Current workaround:
- Rename the class in each file to match the filename:
Filename: Payment.cs
namespace OrderProcessing
public class Payment
{
public void ProcessPayment()
public void ApplyDiscounts()
public void CalculateTaxes()
public void RefundPayment()
}
Filename: Shipping.cs
namespace OrderProcessing
public class Shipping
{
public void PrepareShipment()
public void GenerateTrackingNumber()
}
- Modify
docfx.json
by overwriting the class name in thedocfx.json
, with a.md
file for each class, to restore the intended name OrderProcessor.
docs/PaymentClassOverwrite.md
---
uid: OrderProcessing.Payment
name: OrderProcessor
syntax:
content: public class OrderProcessor
---
docs/ShippingClassOverwrite.md
---
uid: OrderProcessing.Shipping
name: OrderProcessor
syntax:
content: public class OrderProcessor
---
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"docs/PaymentClassOverwrite.md",
"docs/ShippingClassOverwrite.md"
]
}
],
Generate the documentation.
Change the class names back to
Orderprocessor
in the source code.
Is there a better way to document partial classes separately in DocFX without renaming them in code ? Or is merging them into a single entry the only supported behavior ?
If this is not possible in DocFX, are there any other documentation tools that support documenting partial classes separately ? If anyone knows of a tool or has a relevant link, it would be helpful for considering a feature request for DocFX.
本文标签: How to Document Partial Classes Separately in DocFX (C)Stack Overflow
版权声明:本文标题:How to Document Partial Classes Separately in DocFX (C#)? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744949310a2633982.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论