gpt4 book ai didi

c# - 是否可以为一个#region 范围编写多行注释?

转载 作者:行者123 更新时间:2023-11-30 19:29:02 24 4
gpt4 key购买 nike

似乎没有人问过这个问题。如果重复,请发表评论。

也就是说我在 C# 代码中有 #region 注释。

#region if this comment is very long, can I divide the comment into multi-lines?

// my code is here

#endregion

#region 注释是否可以像最下面的代码一样分成多行?

#region the comment is separated into
#region-2 two lines.

// my code is here

#endregion

最佳答案

我不认为长注释是 #region 指令的预期用途。当我想到“区域”时,我会想到诸如“私有(private)成员”或“服务声明”或“重载构造函数”之类的东西,或者那种性质的简单标签。

如果您有很长的评论,我会将其包含在该区域的顶部,如下所示:

#region Some Region Name

/**
* Here is a decently lengthy comment which describes the
* group of class members within the region.
*/

/// <summary>
/// A regular member's comment documentation.
/// </summary>
public int MyRegionProperty { get; set; }

// etc...

#endregion

MSDN#region 之后的部分描述为“名称”,而不是注释。名称应该具有足够的描述性以识别该地区的内容,仅此而已。

关于c# - 是否可以为一个#region 范围编写多行注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13410310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com