Nope, it's not. Consider: TMyType (enum1=5, enum2=15, enum3=25); high() - low() will give you 20, whereas iterating through the enums will give you 3.
Cheers Mike > it's the same thing with high()-low(). > > --- Mike Shkolnik <[EMAIL PROTECTED]> wrote: > > Try the next > > > > var > >�� Data: PTypeData; > >�� i: Integer; > > begin > >�� Result := 0; > >�� Data := GetTypeData(TypeInfo(TyourEnum)); > >�� for i := Data^.MinValue to Data^.MaxValue > >���� Inc(Result) > > end > > > > or > > > > var > >�� i: TyourEnum; > > begin > >�� Result := 0; > >�� for i := Low(TyourEnum) to High(TyourEnum) do > >���� Inc(Result) > > end > > > > But personally I don't use the enum types with > > predefined value for items > > > > With best regards, Mike Shkolnik > > EMail: [EMAIL PROTECTED] > > http://www.scalabium.com > > > > --- Jonathan Mora <[EMAIL PROTECTED]> wrote: > > > won't work with > > > > > > type > > > SomeEnum = (enum1=1, enum2, enum3=9, enum4, > > > enum5=50); > > > > > > --- Mike Shkolnik <[EMAIL PROTECTED]> wrote: > > > > Result := Ord(High(aEnum))-Ord(Low(aEnum))+1 > > > > > > > > Or use the RTTI (TypInfo unit) and read the > > > > MaxValue/MinValue from type: > > > > var > > > >�� Data: PTypeData; > > > > begin > > > >�� Data := GetTypeData(TypeInfo(TEnum)); > > > >�� <you need the Data^.MinValue and > > > > Data^.MaxValue> > > > > > > end > > > > > > > > With best regards, Mike Shkolnik > > > > EMail: [EMAIL PROTECTED] > > > > http://www.scalabium.com > > > > > > > > --- Andries Bos <[EMAIL PROTECTED]> wrote: > > > > > hello > > > > >� > > > > > How do i get the amount of enumerated types > > > > > > > > defined: > > > > >� > > > > > Some code: > > > > > type > > > > > SomeEnum = (enum1, enum2, enum3); > > > > >� > > > > > function ABC� : integer > > > > > var AEnum : Someenum; > > > > > begin > > > > > result := ord(high(aEnum))� > > > > > end; > > > > >� > > > > > Result will return the ordinal of the highest, > > > > > > but > > > > > > > > is there a direct way of getting the count of > > > > > > this > > > > > > > > enum list? > > > > >� > > > > > Regards > > > > >� > > > > > andries > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam?� Yahoo! Mail has the best spam > > protection around > > http://mail.yahoo.com > > ����� ����� > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Helps protect you from nasty viruses. > http://promotions.yahoo.com/new_mail > > > ----------------------------------------------------- > Home page: http://groups.yahoo.com/group/delphi-en/ > To unsubscribe: [EMAIL PROTECTED] > > > > > Yahoo! Groups Sponsor > > > > ADVERTISEMENT > > > > > > > > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/delphi-en/ > � > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > � > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

