Has anybody ever figured a way to automatically loop through an enum,
as if it were a collection? Here's an example of an enum we're using:
public enum TaskType
{
TaskRange = 1,
TaskSort = 2,
TaskScope = 3
}
And what we'd like to loop through each item in a for-each loop, since
we don't always know how many enums there are (without a human being
checking)...
TIA!
Syd"Syd" <sydney@.paigedata.com> wrote in message
news:2c76f997.0308281347.4dc300de@.posting.google.c om...
> Has anybody ever figured a way to automatically loop through an enum,
> as if it were a collection? Here's an example of an enum we're using:
> public enum TaskType
> {
> TaskRange = 1,
> TaskSort = 2,
> TaskScope = 3
> }
> And what we'd like to loop through each item in a for-each loop, since
> we don't always know how many enums there are (without a human being
> checking)...
Take a look at the System.Enum class. In particular, System.Enum.GetNames
might help you out.
--
John Saunders
Internet Engineer
john.saunders@.surfcontrol.com
Saturday, March 24, 2012
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment