Andy

Andy

  • 2k
  • 30
  • 733

Use enum as key in dictionary

Jul 22 2021 5:44 AM

why cannot i initialise a dictionary with values from enum. for example

enum cust {
OneTime
}

dictionary<int, string> custs = new dictionary<int, string>() {
{cust.OneTime, "some string values"}
}

getting argument is not assignable to type int error

any thoughts?


Answers (5)