ContainerBlock Class

A base class for container blocks.

See also

Inheritance
Block ContainerBlock
Implements

Nested types

NameDescription
ContainerBlock.EnumeratorRepresents the Enumerator type.

Constructors

NameDescription
ContainerBlock(BlockParser?)Initializes a new instance of the ContainerBlock class.

ContainerBlock(BlockParser?)

ContainerBlock.cs

Initializes a new instance of the ContainerBlock class.

protected ContainerBlock(BlockParser? parser)

Parameters

parser BlockParser?
The parser used to create this block.

Properties

NameDescription
CountGets or sets the count.
IsReadOnlyGets or sets the is read only.
LastChildGets the last child.

Gets or sets the count.

public int Count { get; }

Property value

int

Gets or sets the is read only.

public bool IsReadOnly { get; }

Property value

bool

Gets the last child.

public Block? LastChild { get; }

Property value

Block?

Indexers

NameDescription
this[int]Gets the value at the specified index.

Gets the value at the specified index.

public Block this[int index] { get; set; }

Parameters

index int

Property value

Block

Methods

NameDescription
Add(Block)Performs the add operation.
Clear()Performs the clear operation.
Contains(Block)Performs the contains operation.
CopyTo(Block[], int)Performs the copy to operation.
GetEnumerator()Specialize enumerator.
HasValidSpan(bool)Checks whether this container span is valid with respect to child block spans.
IndexOf(Block)Performs the index of operation.
Insert(int, Block)Performs the insert operation.
Remove(Block)Performs the remove operation.
RemoveAt(int)Removes at.
Sort(IComparer<Block>)Performs the sort operation.
Sort(Comparison<Block>)Performs the sort operation.
System.Collections.Generic.IEnumerable<Meziantou.Framework.Markdown.Syntax.Block>.GetEnumerator()
System.Collections.IEnumerable.GetEnumerator()
TransferChildrenTo(ContainerBlock)Transfers all children from this container to destination.
UpdateSpanFromChildren(bool, bool)Updates this container span from its child block spans.

Performs the add operation.

public void Add(Block item)

Parameters

item Block

Performs the clear operation.

public void Clear()

Contains(Block)

ContainerBlock.cs

Performs the contains operation.

public bool Contains(Block item)

Parameters

item Block

Returns

bool

CopyTo(Block[], int)

ContainerBlock.cs

Performs the copy to operation.

public void CopyTo(Block[] array, int arrayIndex)

Parameters

array Block[]
arrayIndex int

GetEnumerator()

ContainerBlock.cs

Specialize enumerator.

public ContainerBlock.Enumerator GetEnumerator()

HasValidSpan(bool)

ContainerBlock.cs

Checks whether this container span is valid with respect to child block spans.

public bool HasValidSpan(bool recursive = false)

Parameters

recursive bool
When true, validates descendant container blocks and inline containers recursively.

Returns

bool true when this container span contains all direct child spans and recursive checks (if enabled) succeed; otherwise, false.

IndexOf(Block)

ContainerBlock.cs

Performs the index of operation.

public int IndexOf(Block item)

Parameters

item Block

Returns

int

Insert(int, Block)

ContainerBlock.cs

Performs the insert operation.

public void Insert(int index, Block item)

Parameters

index int
item Block

Remove(Block)

ContainerBlock.cs

Performs the remove operation.

public bool Remove(Block item)

Parameters

item Block

Returns

bool

RemoveAt(int)

ContainerBlock.cs

Removes at.

public void RemoveAt(int index)

Parameters

index int

Sort overloads

Sort(IComparer<Block>)

ContainerBlock.cs

Performs the sort operation.

public void Sort(IComparer<Block> comparer)
Parameters
comparer IComparer<Block>

Sort(Comparison<Block>)

ContainerBlock.cs

Performs the sort operation.

public void Sort(Comparison<Block> comparison)
Parameters
comparison Comparison<Block>

System.Collections.Generic.IEnumerable<Meziantou.Framework.Markdown.Syntax.Block>.GetEnumerator()

ContainerBlock.cs

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

ContainerBlock.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

TransferChildrenTo(ContainerBlock)

ContainerBlock.cs

Transfers all children from this container to destination.

public void TransferChildrenTo(ContainerBlock destination)

Parameters

destination ContainerBlock
The destination container.

Exceptions

ArgumentNullException
Thrown if destination is null.

Remarks

Child order is preserved. This method does not recompute source or destination spans/trivia.

UpdateSpanFromChildren(bool, bool)

ContainerBlock.cs

Updates this container span from its child block spans.

public bool UpdateSpanFromChildren(bool recursive = false, bool preserveSelfSpan = true)

Parameters

recursive bool
When true, updates descendant container blocks and inline containers recursively before updating this container.
preserveSelfSpan bool
When true, preserves this container current span and only expands it to include children. When false, recomputes from children only.

Returns

bool true when this container span changed; otherwise, false.