diff --git a/YamlDotNet/Serialization/NodeDeserializers/ScalarNodeDeserializer.cs b/YamlDotNet/Serialization/NodeDeserializers/ScalarNodeDeserializer.cs index 7395fd37..8f323821 100644 --- a/YamlDotNet/Serialization/NodeDeserializers/ScalarNodeDeserializer.cs +++ b/YamlDotNet/Serialization/NodeDeserializers/ScalarNodeDeserializer.cs @@ -364,13 +364,13 @@ private static object CastInteger(ulong number, TypeCode typeCode) } else if (Regex.IsMatch(v, @"[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?")) //regular number { - if (TryAndSwallow(() => byte.Parse(v), out result)) { } - else if (TryAndSwallow(() => short.Parse(v), out result)) { } - else if (TryAndSwallow(() => int.Parse(v), out result)) { } - else if (TryAndSwallow(() => long.Parse(v), out result)) { } - else if (TryAndSwallow(() => ulong.Parse(v), out result)) { } - else if (TryAndSwallow(() => float.Parse(v), out result)) { } - else if (TryAndSwallow(() => double.Parse(v), out result)) { } + if (TryAndSwallow(() => byte.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => short.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => int.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => long.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => ulong.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => float.Parse(v, YamlFormatter.NumberFormat), out result)) { } + else if (TryAndSwallow(() => double.Parse(v, YamlFormatter.NumberFormat), out result)) { } else { //we couldn't parse it, default to string, It's probably too big