Share via


Generics (C++ Component Extensions)

 

The latest version of this topic can be found at Generics (C++ Component Extensions).

Generics are parameterized types and methods. In this section, find out which generic features are supported by both the Windows Runtime and the common language runtime, and which are supported by only the common language runtime. Also, find out how to author your own generic methods and types in Visual C++, and how to use generic types authored in a .NET Framework language in Visual C++. 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 Visual C++
Information about generics are, the motivation for the language feature, definitions of terms used to describe generics, and information about the use of reference types and value types as type parameters for generics.

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

Generic Delegates (Visual C++)
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 Visual C++.

Generics and Templates (Visual C++)
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.

How to: Iterate Over a Generic Collection with for each
Using the for each, in keyword on a generic collection.

Generics in the .NET Framework Class Library
Discusses .NET Framework class library's System.Collections.Generic, namespace, which includes several ready-to-use generic collection classes and associated interfaces.

Introduction to Generics
The generics section in the C# documentation.

Generic Types in Visual Basic
The generics section in the Visual Basic documentation.

Templates Overview
Information on templates in C++.

See Also

Component Extensions for Runtime Platforms