Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

Structure (Visual Basic) 

Constrains a generic type parameter to require that any type argument passed to it be a value type, or introduces a Structure Statement.

When you declare a type parameter for a generic type, you can impose a constraint, a set of one or more requirements that limit the type argument that can be passed to that type parameter. For more information, see "Constraints" in Generic Types in Visual Basic.

Among the possible requirements in a constraint is that the type argument must be a value type, for example a structure, enumeration, or elementary data type. You specify this by including the Structure keyword in the constraint.

Another possible requirement is that the type argument must be a reference type, for example a String, array, or delegate, or an object created from a class. You specify a reference type requirement by including the Class (Visual Basic) keyword in the constraint.

You do not have to specify either Class or Structure in a constraint. You cannot specify them both in the same constraint.

The Structure constraint is not the same as the Structure Statement.

Community Additions

ADD
Show:
© 2015 Microsoft