Consider simple enum declaration (borrowed from Wikipedia article on enumerated type):
enum CardSuit { Clubs, Diamonds, Spades, Hearts, }
// will not compile:
foreach(CardSuit item in CardSuit) {
var x = "sample string";
// use item…
} //loop
Alternative example:
// Language is not specified
enum CardSuit { Clubs, Diamonds, Spades, Hearts, }
// will not compile:
foreach(CardSuit item in CardSuit) {
var x = "sample string";
// use item…
} //loop