enum enu { a=1, b=2, c=3, d=4 };
private void button2_Click(object sender, System.EventArgs e) {
//foreach
foreach(string s in Enum.GetNames(typeof(enu))){
MessageBox.Show(s);
}
foreach(int s in Enum.GetValues(typeof(enu))) {
MessageBox.Show(s.ToString());
}
//to Array[]
string[] en = Enum.GetNames(typeof(enu));
Array ev = Enum.GetValues(typeof(enu));
}
private void button2_Click(object sender, System.EventArgs e) {
//foreach
foreach(string s in Enum.GetNames(typeof(enu))){
MessageBox.Show(s);
}
foreach(int s in Enum.GetValues(typeof(enu))) {
MessageBox.Show(s.ToString());
}
//to Array[]
string[] en = Enum.GetNames(typeof(enu));
Array ev = Enum.GetValues(typeof(enu));
}