This documentation is archived and is not being maintained.

Generics Samples (Consuming Generics) 

Visual Studio 2005

The samples in this section demonstrate creating generics in C# and consuming them in J#.

Sample Description

Generic Stack Class Sample (Consuming Using J#)

A generic stack class, written in C# and consumed from J#.

Constraint Sample (Constraining a Type Using a Generic Class)

The generic stack type imposes a constraint that the type parameter ‘T’ must be a type that implements the interface IDisplay.

Delegate Sample (Applying a Generic Delegate Type)

A generic delegate type, Proc, is declared in C#. From J#, instantiate and apply the generic delegate type.

Generic Stack Interface Sample (Consuming an Interface)

The generic stack class implements a generic stack interface. From J#, consume this generic stack class in terms of the generic stack interface.

Generic Printing Method Sample (Prints an Array of Types)

A "printer" type has a generic method that can print out an array of types onto the console. This type is consumed from J#, providing different constructed types.

See Also