Ho to convert classname as string to a class ?
Posted
by Roland Bengtsson
on Stack Overflow
See other posts from Stack Overflow
or by Roland Bengtsson
Published on 2010-04-28T07:53:56Z
Indexed on
2010/04/28
8:13 UTC
Read the original article
Hit count: 407
delphi
|delphi-2007
I have classnames in a stringlist. For example it could be 'TPlanEvent', 'TParcel', 'TCountry' etc.
Now I want to find out the sizes by looping the list.
It works to have:
Size := TCountry.InstanceSize;
But I want it like this:
for i := 0 to ClassList.Count - 1 do
Size := StringToClass(ClassList[i]).InstanceSize;
Obviously my question is what to write instead of method StringToClass to convert the string to a class.
© Stack Overflow or respective owner