Hallo,
grundsätzlich würde ich es so lösen
Delphi-Quellcode:
unit Unit2;
interface
uses SysUtils, classes;
Type
TArrayItem =
class(TObject)
private
FName:
String;
public
property Name :
String read FName
write FName;
end;
TArrayItems =
class(TList)
private
function GetArrayItem(
Name:
String): TArrayItem;
public
function Add(
const Itemname :
String) : TArrayItem;
property ArrayItems[
Name :
String] : TArrayItem
read GetArrayItem;
end;
implementation
{ TArrayItems }
function TArrayItems.Add(
const Itemname:
String): TArrayItem;
begin
Result:=TArrayItem.Create;
inherited Add(Result);
end;
function TArrayItems.GetArrayItem(
Name:
String): TArrayItem;
var
iCnt : Integer;
begin
Result:=Nil;
For iCnt:=0
to Count-1
do
begin
If AnsiUpperCase(TArrayItem(Items[iCnt]).
Name)=AnsiUpperCase(
Name)
then
begin
Result:=Items[iCnt];
Exit;
end;
end;
end;
end.