Skip to content

Incorrect side note about VB.NET in Decimal.ToDouble #11707

@HeinziAT

Description

@HeinziAT

Describe the issue or suggestion

The "Remarks" section of Decimal.ToDouble contains the following paragraph:

You can also convert a Decimal to a Double value by using the Explicit assignment operator. Because the conversion can entail a loss of precision, you must use a casting operator in C# or a conversion function in Visual Basic.

The last part of the last sentence ("or a conversion function in Visual Basic") is incorrect. VB.NET (unfortunately) allows implicit conversions from Decimal to Double, even with Option Strict On (cf. Section 8.3 of the VB 11 language specification).

Suggested fix:

You can also convert a Decimal to a Double value by using the Explicit assignment operator. Because the conversion can entail a loss of precision, you must use a casting operator in C#. Visual Basic supports implicit conversions from Double to Decimal, rounding to the nearest Double value.

Alternatively, we could just drop the part about Visual Basic (= suggested fix minus the last sentence).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Runtimedoc-bugProblem with the content; needs to be fixeduntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions