pascalabcnet/TestSuite/generics3.pas
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

19 lines
385 B
ObjectPascal

uses System, System.Collections.Generic;
type TClass = class
end;
begin
var lst: IList<TClass> := new List<TClass>;
var obj: TClass := new TClass();
lst.Add(obj);
assert(lst[0]=obj);
assert(lst.Count=1);
lst.Add(obj);
foreach it: TClass in lst do
begin
assert(it = obj);
end;
var lst2: ICollection<TClass> := lst;
lst2.Clear();
assert(lst2.Count = 0);
end.