public sealed class SettablePropertyValue<T> where T : struct
|
public class GenericList<TEmployee> where TEmployee : Employee
|
public struct Nullable<T> where T : struct, new()
|
Constraint
|
Description
|
where Tparm : struct
|
Tparm must be a value type, and can be any value type except a nullable type (System.Nullable).
For example, valid ABL references to a generic type, SomeGeneric<Tparm>, with this constraint can be:
"SomeGeneric<SHORT>"
"SomeGeneric<System.Drawing.Point>" |
where Tparm : class
|
Tparm must be a reference type, which can be any class, interface, delegate, or array type.
For example, a valid ABL reference to a generic type, SomeGeneric<Tparm>, with this constraint can be:
"SomeGeneric<System.Windows.Forms.Button>"
|
where Tparm : new()
|
Tparm must have a default public constructor (without parameters)
For example, a valid ABL reference to a generic type, SomeGeneric<Tparm>, with this constraint can be:
"SomeGeneric<System.Windows.Forms.Label>"
|
where Tparm : BaseClassName
|
Tparm must be, or derive from, the class specified by BaseClassName.
For example, a valid ABL reference to a generic type defined as SomeGeneric<TControl> where TControl : System.Windows.Forms.Control can be:
"SomeGeneric<System.Windows.Forms.ButtonBase>"
|
where Tparm : InterfaceName
|
Tparm must be, or must implement, the interface specified by InterfaceName. The constraining interface can also be generic.
For example, a valid ABL reference to a generic type defined as SomeGeneric<TICollection> where TICollection : System.Collections.ICollection can be:
"SomeGeneric<System.Collections.Queue>"
|
where Tparm : Uparm
|
The type argument that you substitute for Tparm must be, or must derive from, the type argument that you substitute for another type parameter, Uparm. This is called a naked type constraint.
For example, a valid ABL reference to a generic type defined as SomeGeneric<TValue1, TValue2> where TValue1 : TValue2 can be:
"SomeGeneric<System.Windows.Forms.ButtonBase, System.Windows.Forms.Control>"
|
where Tparm : constraint
, constraint |
Tparm can by constrained by one or more of the previously listed constraints (constraint), as long as the new() constraint is listed last.
For example, a valid ABL reference to a generic type defined as SomeGeneric<TValue> where TValue : class, new() can be:
"SomeGeneric<System.Windows.Forms.Label>"
|