SeparatedSyntaxList Class

Builds SeparatedSyntaxList<TNode> instances.

public static class SeparatedSyntaxList

Methods

NameDescription
Create<TNode>(ReadOnlySpan<TNode>)Creates a detached list holding nodes, with the separator of their language between each pair.

Create<TNode>(ReadOnlySpan<TNode>)

SeparatedSyntaxList.cs

Creates a detached list holding nodes, with the separator of their language between each pair.

public static SeparatedSyntaxList<TNode> Create<TNode>(ReadOnlySpan<TNode> nodes) where TNode : SyntaxNode

Type parameters

TNode

Parameters

nodes ReadOnlySpan<TNode>

Returns

SeparatedSyntaxList<TNode>

Exceptions

InvalidOperationException
There is more than one node and the language does not define a separator for its lists.

Remarks

This is what a collection expression targeting SeparatedSyntaxList<TNode> builds its list with, so [a, b] gives the same list as adding a then b to an empty one.