如何在代码文档中正确指定一个函数在 C# 上可能 return null?

How to properly specify on code-documentation a function may return null on C#?

我正在创建一些代码文档,我想正确显示如果找不到资源,该函数可能 return 为 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 标签 ,但我想知道这是否是 best/correct 方式。

为了将来参考,在深入研究 Microsoft 代码后,即反编译一些 DLL,我发现它们使用以下标准:<paramref name="sourceTimeZone" /> is <see langword="null" />.

示例摘自 System.TimeZoneInfo。

不知道@Ian 在他的评论中引用的是不是这个。