Hi,
im trying to create a parser for excel to generate a pricelist from a csv file.
Im doing this with a parser and a generator. To get all the devices containered, i've created a device object and want to list the accessories in it but i have a problem.
unit Device;
interface
uses
Sysutils, System.Generics.Collections;
type
TDevices = class
DeviceName : string;
private
public
AList: TList<TDictionary<string, string>>;
procedure SetDeviceName(Device : string);
procedure AddAccessories(Name : string; Description: string; Price: string; OType:string);
end;
var
Name: string;
implementation
procedure TDevices.AddAccessories(Name, Description, Price, OType: string);
begin
AList.Add(TDictionary<string, string>.Create());
AList[AList.Count-1].Add('name', Name);
AList[AList.Count-1].Add('description', Description);
AList[AList.Count-1].Add('price', Price);
AList[AList.Count-1].Add('type', OType);
end;
procedure TDevices.SetDeviceName(Device: string);
begin
Name:=Device;
AList := TList<TDictionary<string, string>>.Create();
end;
end.
I call the
TDevices.AddAccessories
in a
for
statement. The first run is ok an there is no error. But when
TDevices.AddAccessories
is getting called the 2nd time, i get an access violation error. Can anyone help me?
Sorry for my bad english, im from switzerland :)