Ich vermute er sucht so etwas:
Delphi-Quellcode:
type
PString = ^String;
TADUser = record
private
function FindField(const AFieldName: string): PString;
procedure SetField(const AFieldName, AFieldValue: string);
function GetField(const AFieldName: string): string;
public
cn,name,sn,givenName,displayName: string;
property Field[const AFieldName: string]: string read GetField write SetField; default;
end;
function TADUser.FindField(const AFieldName: string): PString;
begin
if AnsiSameText(AFieldName, 'givenName') then
Result := @givenName
else if AnsiSameText(AFieldName, 'displayName') then
Result := @displayName
else
Result := nil;
end;
procedure TADUser.SetField(const AFieldName, AFieldValue: string);
var
lField: PString;
begin
lField := FindField(AFieldName);
if Assigned(lField) then
lField^ := AFieldValue;
end;
function TADUser.GetField(const AFieldName: string): string;
var
lField: PString;
begin
lField := FindField(AFieldName);
if Assigned(lField) then
Result := lField^
else
Result := '';
end;
var
ADUser: TADUser;
begin
ADUser['givenName'] := 'Max Mayer';
end;
Sollte ab Delphi 2007 funktionieren.