YamlNumberHandling enum
Determines how YamlSerializer handles numbers when serializing and deserializing. The behavior of YamlNumberHandling.WriteAsString and YamlNumberHandling.AllowNamedFloatingPointLiterals is not defined by the YAML specification. Altering the default number handling can potentially produce YAML that cannot be parsed by other YAML implementations.
Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll
[Flags]
public enum YamlNumberHandling
Determines how YamlSerializer handles numbers when serializing and deserializing. The behavior of YamlNumberHandling.WriteAsString and YamlNumberHandling.AllowNamedFloatingPointLiterals is not defined by the YAML specification. Altering the default number handling can potentially produce YAML that cannot be parsed by other YAML implementations.
FieldsLink to this heading
| Name | Value | Description |
|---|---|---|
Strict |
0 | Numbers will only be read from YamlTokenType.Number tokens and will only be written as YAML numbers (without quotes). |
AllowReadingFromString |
1 | Numbers can be read from YamlTokenType.String tokens. Does not prevent numbers from being read from YamlTokenType.Number token. Strings that have escaped characters will be unescaped before reading. Leading or trailing trivia within the string token, including whitespace, is not allowed. |
WriteAsString |
2 | Numbers will be written as YAML strings (with quotes), not as YAML numbers. This behavior is not defined by the YAML specification. Altering the default number handling can potentially produce YAML that cannot be parsed by other YAML implementations. |
AllowNamedFloatingPointLiterals |
4 | The "NaN", "Infinity", and "-Infinity" YamlTokenType.String tokens can be read as floating-point constants, and the Single and Double values for these constants (such as Single.PositiveInfinity and Double.NaN) will be written as their corresponding YAML string representations. Strings that have escaped characters will be unescaped before reading. Leading or trailing trivia within the string token, including whitespace, is not allowed. This behavior is not defined by the YAML specification. Altering the default number handling can potentially produce YAML that cannot be parsed by other YAML implementations. |