简体   繁体   中英

How to refer to enum constants in c# xml docs

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.

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)

我认为您不应该需要前缀 - 可能需要在定义Orientation类型的命名空间中添加“using”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM