The previous page shows generics in use with the inbuilt List<T> class. In this section the demonstrations show how to construct and use generic linked lists, queues and stacks. See our Pascal tutorial on Lists, Stacks and Queues for simpler examples without the use of generics. The examples in this section show how generics save the programmer time by requiring a single routine instead of a separate slightly different one for each type to be manipulated.

The Free Pascal Wiki gives the syntax for the use of generics (in Free Pascal, usually running in the Lazarus IDE):

  generic TList<T> = class
    Items : array of T;
    procedure Add(Value : T);

The generic prefix to the class name is not required in Oxygene.

Programming - a skill for life!

Language features such as loops, generics, class contracts, asynchronous methods, futures and Sugar in Oxygene for Java