I was wondering is there is some C#\Visual Studio magic where I can have a list of strings that form a allow list for parameter inputs into a function?
In other words I would have a list of strings [“Green”, “yellow”, “blue”]
and a function void example(string colour);
. If I try to do example("red");
I get a complier error.
Bonus point if I can read this list for a text file or something, but copy and paste is fine.
Thanks
EDIT: I have ended up using const string C_RED = "RED". I never noticed that intellisence will give you a list of const. This works well as I can just type C_ and it will give me the valid options.