Whenever I’m away from C# for a while I forget how to do some simple things. Googling on how to get the string equivalent of an enumeration in C#, turns up lots of hits but most of them take a very convoluted approach.
Here’s the easiest way I know to treat an enum as a string. Given the RelayState enum:
You can create an instance of the enum and get the string equivalent as follows:
When you display relay_state_name it will show “Two”.