Edit

Share via


Generics (C++/CLI and C++/CX)

Generics are parameterized types and methods. In this section, find out which generic features both the Windows Runtime and the common language runtime support, and which ones only the common language runtime supports. You'll also find out how to author your own generic methods and types in C++/CLI, and how to use generic types authored in a .NET Framework language in C++/CLI. Finally, this section provides a comparison of generics and C++ templates.

In This Section

Supported by the Windows Runtime and the Common Language Runtime

Overview of Generics in C++/CLI
Information about what generics are, the motivation for the language feature, and definitions of terms that are used to describe generics. Also, information about the use of reference types and value types as type parameters for generics.

Generic Interfaces (C++/CLI)
Information about defining and using generic interfaces.

Generic Delegates (C++/CLI)
Information about defining and using generic delegates.

Constraints on Generic Type Parameters (C++/CLI)
Information about using constraints in generic types.

Consuming Generics (C++/CLI)
Information about using generics defined in .NET assemblies, possibly authored in other languages, in C++/CLI.

Generics and Templates (C++/CLI)
A comparison of generics and templates, when to use each, and how to combine them usefully.

Supported by the Common Language Runtime

Generic Functions (C++/CLI)
Information about defining and using generic functions and methods.

Generic Classes (C++/CLI)
Information about defining and using generic classes.

Using the for each, in keyword on a generic collection.

See also

Component Extensions for .NET and UWP