Term cloud

Constraint

Constraint is condition on a type parameter that restricts the type argument you can supply for it. A constraint can require that the type argument implement a particular interface, be or inherit from a particular class, have an accessible parameterless constructor, or be a reference type or a value type. You can combine these constraints, but you can specify at most one class.

Ex:

C#
class SampleClass<T>
where T : IComparable
{
}

VB#
Class CompGen(Of T As IComparable)

0 comments:

Post a Comment

 

Dot net terms Copyright © 2010 | Designed by Ipietoon for Free Blogger Template