type TClass = class(System.Collections.Generic.IComparer>) i: integer; public function Compare(a, b: TClass): integer; begin Result := integer(a.i > b.i); end; end; begin var o:object := new System.Collections.Generic.List(); var e := System.Collections.Generic.List&(o); assert(e.Count = 0); e := o as System.Collections.Generic.List; assert(e.Count = 0); var a := 0; if o is System.Collections.Generic.List& then a := 1; assert(a = 1); o := 'abc'; var s := string(o); var s1 := o as string; assert(o as string = 'abc'); assert(string(o) = 'abc'); assert(s = 'abc'); assert(s1 = 'abc'); o := 2; assert(integer(o) = 2); o := new List; assert((o as List).Count = 0); assert(List&(o).Count = 0); o := new TClass; (o as TClass).i := 2; assert((o as System.Collections.Generic.IComparer>) <> nil); var cmp := System.Collections.Generic.IComparer&>(o); assert(cmp.Compare(o as TClass,o as TClass) = 0); cmp := o as System.Collections.Generic.IComparer>; assert(cmp.Compare(TClass&(o),TClass&(o)) = 0); end.