Compartilhar via


Expansão (Visual Basic)

Indicates that a conversion operator (CType) converts a class or structure to a type that can hold all possible values of the original class or structure.

Converting with the Widening Keyword

The conversion procedure must specify Public Shared in addition to Widening.

Widening conversions always succeed at run time and never incur data loss. Examples are Single to Double, Char to String, and a derived type to its base type. This last conversion is widening because the derived type contains all the members of the base type and thus is an instance of the base type.

The consuming code does not have to use CType for widening conversions, even if Option Strict is On.

The Widening keyword can be used in this context:

Instrução Operator

Por exemplo as definições de ampliação e de restrição de operadores de conversão, consulte Como: Definir um operador de conversão (Visual Basic).

Consulte também

Tarefas

Como: Definir um operador (Visual Basic)

Como: Definir um operador de conversão (Visual Basic)

Referência

Instrução Operator

Restrição (Visual Basic)

Função CType (Visual Basic)

Opção declaração estrito

Conceitos

Conversões de expansão e restrição (Visual Basic)