Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

YamlSequence

OfficeIMO.Yaml

Namespace
OfficeIMO.Yaml
Assembly
OfficeIMO.Yaml
Source revision
0eef6a5756b9 with working tree changes
Implements
IReadOnlyList<YamlNode> IReadOnlyCollection<YamlNode> IEnumerable<YamlNode> IEnumerable
Modifiers
sealed
Attributes
DefaultMember("Item")

A sequence node: block (- item) or flow ([a, b]), in source order.

Inheritance

Usage

Explore 5 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Constructors

YamlSequence 2 overloads
public YamlSequence() #

Creates an empty block sequence. Inside a flow collection it is written as flow.

public YamlSequence(YamlStyle style) #

Creates an empty sequence with a style: YamlStyle.Block or YamlStyle.Flow ([a, b]).

Parameters

style OfficeIMO.Yaml.YamlStyle required

Exceptions

  • ArgumentOutOfRangeException – style is not a collection style.

Methods

public YamlNode Add(YamlNode? item) #

Adds an item at the end, in the layout and quoting of the other items.

Parameters

item OfficeIMO.Yaml.YamlNode? required

Returns

YamlNode The item, now in the sequence.

Exceptions

  • InvalidOperationException – item already belongs to a collection.
public Enumerator GetEnumerator() #

Returns an enumerator over the items that does not allocate.

Returns

Enumerator
public YamlNode Insert(int index, YamlNode? item) #

Inserts an item before the item at index, or at the end when it equals YamlSequence.Count.

Parameters

index int required
item OfficeIMO.Yaml.YamlNode? required

Returns

YamlNode The item, now in the sequence.

Exceptions

public void RemoveAt(int index) #

Removes the item at a position together with the comment lines above it, its lines and its trailing comment.

Parameters

index int required

Exceptions

  • ArgumentOutOfRangeException – index is outside the sequence.
  • InvalidOperationException – Aliases elsewhere refer to an anchor inside the item.

Properties

public int Count { get; } #

Gets the number of items.

public YamlNode this[int index] { get; set; } #

Gets the item at a zero-based index, or replaces it. Aliases are returned as YamlAlias nodes. A scalar set over a scalar updates it in place, keeping its anchor, tag, comments and, for an equal value, its text.

Parameters

index int required

Exceptions

  • ArgumentOutOfRangeException – index is outside the sequence.