Export (0) Print
Expand All

Conversions Between .NET Framework Types and Java Wrapper Types

Visual Studio 2005

In Visual J# 2005, Java-language wrapper types support IConvertible, enabling them to participate in conversions to .NET runtime types.

The IConvertible interface provides methods that allow types to be converted to common language runtime types. For details on these methods, see the documentation for the IConvertible interface. The following Java-language types now implement IConvertible:

Types Supporting IConvertible

java.lang.Boolean

java.lang.Long

java.lang.Byte

java.lang.Short

java.lang.Character

java.lang.String

java.lang.Double

java.math.BigInteger

java.lang.Float

java.math.BigDecimal

java.lang.Integer

java.util.Date

Some conversions are not allowed. If a disallowed conversion is attempted using one of the IConvertible methods, an InvalidCastException is thrown. An exception is thrown for the following conversions:

Disallowed Conversions
From To

java.lang.Character

System.Boolean

java.lang.Character

System.Single

java.lang.Character

System.Double

java.lang.Character

System.Decimal

java.lang.Boolean

System.Char

java.lang.Float

System.Char

java.lang.Double

System.Char

java.math.BigDecimal

System.Char

java.math.BigInteger

System.Char

java.util.Date

Any type except System.String or System.DateTime

Any type except java.lang.String or java.util.Date

System.DateTime

Community Additions

ADD
Show:
© 2015 Microsoft