Skip to content

Fix implicit cast operator for JsonNumber #30523

@kasiabulat

Description

@kasiabulat

Implicit cast operator for JsonNumber can throw an exception, which is against the FDG:
https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/operator-overloads#conversion-operators. We need to consider if we want implicit cast operators for JsonNumber, JsonBoolean and JsonString at all.

JsonNumber number = float.PositiveInfinity; // throws

_Originally posted by @ahsonkhan in dotnet/corefx#39917 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions