0

Enum in loops?

can i use for loop to have the elements of for example enum Days as output?

9th Nov 2016, 9:04 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar
5 Réponses
+ 2
Yes you can use example foreach and in the loop and you can assign the value through this sample var enum= Enum.GetValues(typeof(yourEnum)).Cast<yourEnum>()
9th Nov 2016, 10:22 PM
Klaid Begeja
Klaid Begeja - avatar
+ 1
thank you very much for the examples.
10th Nov 2016, 4:23 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar
+ 1
I just post an example of foreach loop with enum. Hope this can help.
10th Nov 2016, 10:33 PM
Klaid Begeja
Klaid Begeja - avatar
0
Please help again. i tried to create the foreach loop with an enum Days{Mon, Tue, Wen, Thu, Fri, Sat, Sun}, but it drops a lot of error. I dont really understand, How i coud debug it.
10th Nov 2016, 9:19 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar
0
Thanks for the code, now i see my mistake.
11th Nov 2016, 1:46 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar