Current .Net Version: 2.0.50727
Home
Articles
C# & .Net Framework Reference
Practice C# Online
XML Web Services
RSS Feeds
Code Snippets
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog




ROR XML Info.
C# & .Net Framework Reference
Constraints on Type Parameters (C#)

Full Name:
Constraints on Type Parameters (C#)

Short Name:
Constraints on Type Parameters (C#)

Type of Entity:
C#

Abstract:
When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code attempts to instantiate your class with a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are called constraints. Constraints are specified using the where contextual keyword. The following table lists the six types of constraints:

MSDN Source URL:
http://msdn2.microsoft.com/d5x73970.aspx

 
COPYRIGHT/DISCLAIMER | CONTACT US