Decimal.op_Explicit Method (Decimal)

Converts a Decimal to a single-precision floating-point number.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

'Declaration
Public Shared Narrowing Operator CType ( _
	value As Decimal _
) As Single
'Usage
Dim input As Decimal
Dim output As Single

output = CType(input, Single)
Not applicable.

Parameters

value

A Decimal to convert.

Return Value

A single-precision floating-point number that represents the converted Decimal.

This operation can produce round-off errors because a single-precision floating-point number has fewer significant digits than a Decimal.

This operator supports the explicit conversion of a Decimal to a Single. The syntax for such explicit conversions is language-dependent, and individual language compilers can provide different implementations and return different results. The example illustrates the different return values when you explicitly convert a Decimal value to a Single value by using C# and Visual Basic. To perform a conversion that is independent of language, you can call the ToSingle or the Convert.ToSingle(Decimal) method.

The following code example converts Decimal numbers to Single values using the explicit Decimal to Single conversion.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show: