I have declared an enum
as follows:
public enum Numbers {
One= 1,
Two
}
Now, I need to return the key and value pair of the Enum as an array shown below. How can I do this ?
Expected Output
[{ "1": "One" }, { "2": "Two" } ]
What I was trying
This gives the values, but not the key and I need to structure it in to an array.
var values = Enum.GetValues(typeof(Numbers));