|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
new Constraint (C# Reference)
The new constraint specifies that any type argument in a generic class declaration must have a public parameterless constructor. To use the new constraint, the type cannot be abstract.
Apply the new constraint to a type parameter when your generic class creates new instances of the type, as shown in the following example:
When you use the new() constraint with other constraints, it must be specified last:
For more information, see Constraints on Type Parameters (C# Programming Guide).
For more information, see the C# Language Specification.
4.4.3 Satisfying constraints
10.1.6 Type parameter constraints