次の方法で共有


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.

Remarks

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.

See Also

Reference

Class (Visual Basic)
Structure Statement

Concepts

Generic Types in Visual Basic
Value Types and Reference Types