Enum HumlNumberHandling
- Namespace
- Huml.Net.Versioning
- Assembly
- Huml.Net.dll
Controls how Huml.Net.Serialization.HumlSerializerImpl and Huml.Net.Serialization.HumlDeserializer handle numeric values.
[Flags]
public enum HumlNumberHandling
Fields
AllowReadingFromString = 1Permits coercing a
ScalarKind.Stringscalar (a quoted value such as"42") to a numeric target type during deserialisation. Without this flag, such an assignment throws HumlDeserializeException.Strict = 0Default strict behaviour: numeric values are emitted as bare HUML literals and a quoted-string scalar cannot be coerced to a numeric target type during deserialisation.
WriteAsString = 2Emits finite numeric values as quoted HUML strings during serialisation.
NaN,+inf, and-infare never quoted — they are HUML native scalar kinds.
Remarks
When AllowReadingFromString is set, a ScalarKind.String scalar
(i.e. a quoted HUML value such as "42") may be coerced to a numeric target type
during deserialisation. Without this flag, assigning a quoted string to a numeric
property throws HumlDeserializeException.
When WriteAsString is set, finite numeric values (integers, float,
double, decimal) are emitted as quoted HUML strings rather than bare
numeric literals. NaN, +inf, and -inf are always emitted
unquoted regardless of this setting — they are HUML native scalar kinds and must
remain unquoted for round-trip correctness.
Combining WriteAsString and AllowReadingFromString produces a round-trip-safe configuration where every numeric value survives a serialise-then-deserialise cycle.