22

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.

Bruno Martinez
  • 2,850
  • 2
  • 39
  • 47

2 Answers2

13

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)

João Angelo
  • 56,552
  • 12
  • 145
  • 147
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.

RobSiklos
  • 8,348
  • 5
  • 47
  • 77
  • Late to the party, but this is probably the correct answer. Also note, that if you have naming collisions, you need to add one (or more) level(s) of the namespace: say you have a class `NamespaceX.A` with property `MyEnum` of type enum `NamespaceX.Enums.MyEnum` (same name) and the enum has an enumeration value of `One`. IN the class `NamespaceX.A` you reference with `` the property `NamespaceX.A.MyEnum`. If you want to reference the enum instead, use `` or if you want to reference the enumeration value use `` – boast Dec 17 '21 at 15:03