[Solved] Create enum class to assign Index [duplicate]


Use a dictionary better, they are exactly meant to store a value corressponding to a given object.

Dictionary<string, int> dict = new Dictionary<string, int>() { 
  {"Jack", 1 }, {"Alice", 2 }, {"Steven", 3 }, {"Alex", 4 }, {"Katrin", 5 }};

string name = "Jack";

int value = dict[name]; // returns 1

1

solved Create enum class to assign Index [duplicate]