Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- String40 = string;
- type
- TPerson = class
- private
- FFirstName = String40;
- published
- FirstName: string40 read FFirstName write FFirstName;
- end;
- var
- MyPropInfo: TPropInfo;
- PropTypeName: string;
- MyPerson: TPerson;
- begin
- MyPerson := TPerson.Create;
- MyPropInfo := GetPropInfo(MyPerson, 'FirstName')^;
- PropTypeName := MyPropInfo.PropType^.Name;
- type
- String40 = type string;
- program Project1;
- uses
- Classes,
- typInfo,
- Dialogs,
- Forms;
- {$R *.RES}
- type
- String40 = type string;
- TPerson = class(TPersistent)
- private
- FFirstName: String40;
- published
- property FirstName: string40 read FFirstName write FFirstName;
- end;
- var
- MyPropInfo: TPropInfo;
- PropTypeName: string;
- MyPerson: TPerson;
- begin
- Application.Initialize;
- MyPerson := TPerson.Create;
- MyPropInfo := GetPropInfo(MyPerson, 'FirstName')^;
- PropTypeName := MyPropInfo.PropType^.Name;
- ShowMessage(PropTypeName);
- end.
- type
- String40 = type string;
- TPerson = class
- private
- FFirstName : String40;
- published
- property FirstName: string40 read FFirstName write FFirstName;
- end;
- var
- MyPropInfo: PPropInfo;
- PropTypeName: string;
- MyPerson: TPerson;
- begin
- MyPerson := TPerson.Create;
- try
- MyPerson.FirstName := 'My first name';
- MyPropInfo := GetPropInfo(MyPerson, 'FirstName');
- if MyPropInfo<>nil then begin
- PropTypeName := MyPropInfo^.PropType^.Name;
- Memo1.Lines.Add(PropTypeName);
- end;
- finally
- MyPerson.FRee;
- end;
- end;
Add Comment
Please, Sign In to add comment