Table of Contents

Method List

Namespace
Velvet
Assembly
Velvet.Docs.dll

List<T>(IReadOnlyList<T>, Func<T, string>, Func<T, VNode>)

Builds a keyed VNode list from a collection by mapping each item to a VNode and attaching a stable per-item key. If renderer returns null for an item, the slot is included in the array but skipped by the Reconciler's FlattenAndFilter.

public static VNode?[] List<T>(IReadOnlyList<T> items, Func<T, string> keySelector, Func<T, VNode> renderer)

Parameters

items IReadOnlyList<T>

Source collection. When null or empty, returns an empty VNode array.

keySelector Func<T, string>

Selector that derives a stable per-item key.

renderer Func<T, VNode>

Function that produces a VNode for each item.

Returns

VNode[]

Array of rendered VNodes (each carrying the selected key).

Type Parameters

T

Element type of the source collection.

List<T>(IReadOnlyList<T>, Func<T, int, string>, Func<T, int, VNode>)

Builds a keyed VNode list from an indexed collection, mapping each item together with its index to a VNode.

public static VNode?[] List<T>(IReadOnlyList<T> items, Func<T, int, string> keySelector, Func<T, int, VNode> renderer)

Parameters

items IReadOnlyList<T>

Source collection. When null or empty, returns an empty VNode array.

keySelector Func<T, int, string>

Selector that derives a stable per-item key from the item and its index.

renderer Func<T, int, VNode>

Function that produces a VNode from the item and its index.

Returns

VNode[]

Array of rendered VNodes (each carrying the selected key).

Type Parameters

T

Element type of the source collection.