YamlCommentHandling enum

This enum defines the various ways the Utf8YamlReader can deal with comments.

Namespace: System.Text.Yaml ยท Assembly: Styml.dll

public enum YamlCommentHandling : byte

This enum defines the various ways the Utf8YamlReader can deal with comments.

RemarksLink to this heading

YAML's # comments are always read: skipped with YamlCommentHandling.Disallow and YamlCommentHandling.Skip, returned as tokens with YamlCommentHandling.Allow.

JSON comments (// to the end of the line, and /* */) are not YAML. They are read with YamlCommentHandling.Skip and YamlCommentHandling.Allow, as System.Text.Json reads them under the same values, in a JSON payload: inside flow collections ([ ] and { }) and at the document level, before and after the root node. They are never read inside a block collection, where url: http://x // y keeps its text. A comment starts where a token may start, after white space, or directly after a JSON number, true, false or null ([1//c), as in JSON. Other text keeps its slashes: [http://x, a//b] holds two scalars, as a#b is a scalar in YAML.

FieldsLink to this heading

Name Value Description
Disallow 0 The default, standard YAML: # comments are skipped, and // and /* */ are not comments. They are read as YAML reads them: text in a plain scalar ({"a": 1 // c} holds the string 1 // c), or an error where no scalar may stand. System.Text.Json rejects comments under this value.
Skip 1 Skip comments: # comments, and JSON comments in a JSON payload. The Utf8YamlReader behaves as if no comments were present.
Allow 2 Return comments as YamlTokenType.Comment tokens, so the caller can read their text: # comments, and JSON comments in a JSON payload. The token's value is the text after # or //, or between /* and */.

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close