I am working with a Swagger API documentation and want to have my description of the enums in the documentation. I am using a custom filter to extract information from classes and enums, using annotations.
e.g.:
using System.ComponentModel;
...
[DisplayName("Upload class")] // Works fine
public class Upload
{
[DisplayName("Primary Key")] // Works fine
public int UploadMetaId { get; set; }
[Display(Name = "document name")] // Works fine too
public string Title { get; set; }
}
But I have problems with my Enums:
[DisplayName("Document types")] // Illegal, gives error CS0592
// or
[Display(Name = "Document types")] // Illegal too, gives also CS0592
public enum UploadType
{
[Display(Name = "Årsopgørelse")] // Works fine
PartnerAarsopgoerelse = 1,
[Display(Name = "Ægtefælles årsopgørelse")]
AegtefaelleAarsopgoerelse = 2
}
The error CS0592 says it’s not valid on this declaration type.
So what can I use instead?