Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
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:
For example definitions of widening and narrowing conversion operators, see How to: Define a Conversion Operator.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register now