Skip to content

unable to load numbers without decimal places as double #36

@BluBb-mADe

Description

@BluBb-mADe

All numbers without decimal places are automatically loaded as integers which makes the implicit cast to double impossible.
The only way around is an abomination like this:

double value = _tomlFile["myFloatVal"].IsInteger ? (int)_tomlFile["myFloatVal"] : _tomlFile["myFloatVal"];

Otherwise the implicit operator double(TomlNode value) => value.AsFloat.Value; will throw an exception.

Is there really no way around this?

I am using .net 6.0 and the Tommy 3.1.2 NuGet package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions