This is a hang over from my Delphi days where I was able to do something as follows:
type
TCars = (Ford, Nissan, Toyota, Honda);
const
CAR_MODELS = array[TCars] of string = ('Falcon','Sentra','Camry','Civic');
which allowed me to an enumeration declartively with some associated data. In this case a string but it could have been a record structure or similair. It meant that if I added a member to TCars and forgot to update the CAR_MODELS array I would get a compile time error.
What is the C# approach to this? I have tried:
public enum ReportFileGeneratorFileType
{
Excel,
Pdf,
Word
}
string[ReportFileGeneratorFileType] myArray = {"application/vnd.ms-excel", "application/pdf", "application/vnd.ms-word"};
but that does not appear to compile.
c#has something that will give you an error if you don't update a description.