0

I wanted to assign an array value to enum.

for ex:-

string[] ArrayControl = new string[3] {'simple','standard','advanced'}; 

public enum Control
{
simple,
standard,
advanced
}

Can we apply array value to enum dinamically?

KumarV
  • 162
  • 2
  • 13

1 Answers1

1

Are you looking for this:

ArrayControl = Enum.GetNames(typeof(Control));

This will populate ArrayControl with all the names of enum Control. You can then bind your drop down list to ArrayControl.

Giorgos Betsos
  • 71,379
  • 9
  • 63
  • 98
  • the dropdown control only takes value from enum, so i can not assign it using array. that's why i need to assign all my values to enum first then it will come to dropdown. – KumarV Sep 19 '16 at 14:23