简单:有什么方法可以在 Visual Studio 中为局部变量设置 XML 注释?专门寻找以下内容(不在任何版本的 VS 中都有效)。
如:
/// <summary>
/// Perform editing of multiple HexCells in the HexGrid.
/// </summary>
void EditCells(HexCell center)
{
/// <summary>
/// This is the horizontal center of the a cell that I'm working with.
/// </summary>
var centerX = center.coordinates.X;
/// <summary>
/// This is the vertical center of the a cell that I'm working with.
/// </summary>
var centerZ = center.coordinates.Z;
...
有什么办法吗?
最佳答案
不,用 XML 记录局部变量是没有意义的。
XML 文档为那些使用您的程序集/类/方法的人提供信息。它不应该通过代码读取。他们无法访问局部变量,因此他们将无法访问此文档。
如果您想对那些阅读或维护您的代码的人发表评论,那么您可以只使用简单的评论。
关于c# - 有没有办法给局部变量设置 XML 注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45973130/