Using angle brackets (I've seen people using TList <PSomething>)

I see people announcing their TLists as

MyList : TList<PSomeType>;

Later, when they create it, they do

MyList := TList<PSomeType>.Create;

Therefore, I believe that in doing this, they will not have to resort to the MyList.Items [I] method when they use it, for example:

ShowMessage( PSomeType(MyList.Items[I]).SomeTextProperty );

So instead they just do

ShowMessage( MyList.Items[I].SomeTextProperty );

Is it correct?

If so, why can't I get it to work in Delphi 2010? I am trying exactly this: declare a list as

MyList : TList<PSomeType>;

But the compiler says:

Undeclared identifier: TList <>

What am I doing wrong there?

+2
source share
1 answer

. TList<T> - TList ​​ Generics.Collections, Classes, TList. Generics.Collections , .

+14

All Articles