![]() |
Set durchsuchen
Hallo ihr,
ich habe ein Set einer Enumeration
Delphi-Quellcode:
Nun habe ich eine Methode, die je nach Enum-Wert verschieden reagiert und eine Methode mit dem Set:
type
TEnum = (eA, eB, eC); TEnums = set of TEnum;
Delphi-Quellcode:
Wie kann ich nun in "DoSomethingOther" die Einträge in AEnums durchgehen und mit DoSomething aufrufen?
procedure DoSomething(AEnum : TEnum);
procedure DoSomethingOther(AEnums : TEnums); Also sowas in der der Art:
Delphi-Quellcode:
Ich könnte natürlich das umständlich machen, aber dass ist an sich ja ziemlich umständlich ;)
for i := 0 to Length(AEnums) - 1 do
DoSomething(AEnum[i]);
Delphi-Quellcode:
MfG
if eA in AEnums then
DoSomething(eA); ... xZise |
Re: Set durchsuchen
Delphi-Quellcode:
type
TEnum = (eA, eB, eC); TEnums = set of TEnum; procedure DoIt(const ASet: TEnums); var lIndex: TEnum; begin for lIndex := low(TEnum) to high(TEnum) do begin if lIndex in ASet then DoSomething(lIndex); end; end; |
Re: Set durchsuchen
Danke,
damit funktioniert es. MfG xZise |
Re: Set durchsuchen
Hallo,
ich hätte noch eine Ergänzung:
Delphi-Quellcode:
Gruß Hawkeye
procedure DoItAgain(const ASet: TEnums);
var lIndex: TEnum; begin for lIndex in ASet do DoSomething(lIndex); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:47 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz