How to refer to enum constants in c# xml docs

↘锁芯ラ 提交于 2019-12-05 10:32:52

问题


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.


回答1:


The prefixes F, M and E 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)




回答2:


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.



来源:https://stackoverflow.com/questions/2745043/how-to-refer-to-enum-constants-in-c-sharp-xml-docs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!