Thursday, June 22, 2006

foreach Item in Enumerator?!

This is just a quick snippet but the other day I was trying to do a foreach thru an Enumerator, after a llittle tinkering and enquiry with our resident guru I was provided with this nasty looking bit of code that works like a charm - basically all it does is push the contents of the Enum into an Array, Array supporting the IEnumerable interface of course makes it easy to foreach thru!

Array Attributes = Enum.GetValues(typeof(Enumerator));
Post a Comment