【发布时间】:2019-02-28 15:37:55
【问题描述】:
我正在创建一些代码文档,并且我想正确显示如果找不到资源,该函数可能会返回 null。
我创建的带有一些代码文档的虚拟方法,以 GhostDoc 自动生成的文档为基础:
///<summary>Gets something for the specified unique identifier.</summary>
///<param name="id">Something's unique identifier.</param>
///<returns>Something if found; otherwise <c>null</c>.</returns>
private Something GetSomethingById(int id)
{ }
我目前在 Null 周围使用 XML 标记 ,但我想知道这是否是最好/正确的方法。
【问题讨论】:
-
为什么你认为你的例子是错误的?
-
我不是在假设它是错的,这只是我的做法。我只是想知道是否有更好的方法或更标准的方法,至少在 C# 中。
-
您的方法有先例 - 请参阅 Microsoft 的任何在线文档。当他们引用
null时,它是使用等宽字体作为代码完成的 -
@Ian 你的意思是这样的:helixoft.com/blog/… ?
标签: c# xml documentation xml-documentation code-documentation