On Mon, 6 Sep 2004 09:52:15 +0100, "Claire" <bl****@blahhhhh.com>
wrote:
Is there an easy way to return the number of elements in an enumerated type
please
thanks
Claire
There are several useful replies involving Enum.GetValues.
However, if your enumeration doesn't set explicit values but just
lets them default to 0, 1, 2, ... then I sometime just include a Last
member, e.g.,
enum cardSuits {clubs, spades, diamonds, hearts, Last}
then the number of "real" values in the enumeration reduces
to cardSuits.Last which can be cast to whatever type of
counting variable you wish, int, long, byte...
Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?