如何在 C# xml 文档中引用枚举常量
我想记录枚举类型字段的默认值:
/// <summary>
/// The default value is <see cref="Orientation.Horizontal" />.
/// </summary>
public Orientation BoxOrientation;
编译器警告它无法解析引用。前缀 F: 或 M: 会使编译器静音,但 E: 也会静音,所以我不确定哪个前缀是正确的。
I want to document the default value of an enum typed field:
/// <summary>
/// The default value is <see cref="Orientation.Horizontal" />.
/// </summary>
public Orientation BoxOrientation;
The compiler warns that it couldn't resolve the reference. Prefixing F: or M: silences the compiler, but E: also does, so I'm unsure what prefix is correct.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
前缀
F
、M
和E
都是有效的,并且可能是编译器警告消失的原因。但是,您应该使用引用字段的
F
。有关 Visual Studio 如何生成文档标识符的详细信息,请参阅:处理 XML 文件(C# 编程)指南)
The prefixes
F
,M
andE
are all valid and probably the reason that the compiler warning disappears.You should however use the
F
that refers to fields. For more information on how Visual Studio generates documentation identifiers see:Processing the XML File (C# Programming Guide)
我认为您不需要前缀 - 可能您需要向定义
Orientation
类型的命名空间添加“using”。I don't think you should need the prefix - probably you need to add a "using" to the namespace where the
Orientation
type is defined.