From b3bee29c04f07f2a36d6401b1b810f66a20861cf Mon Sep 17 00:00:00 2001 From: Benito Palacios Sanchez Date: Fri, 24 Nov 2023 12:46:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20Document=20new=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/articles/core/virtual-file-system/nodes.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/articles/core/virtual-file-system/nodes.md b/docs/articles/core/virtual-file-system/nodes.md index 2b64a563..b4ee52e3 100644 --- a/docs/articles/core/virtual-file-system/nodes.md +++ b/docs/articles/core/virtual-file-system/nodes.md @@ -146,6 +146,23 @@ fluent-like for chaining conversions. [!code-csharp[transform chaining](./../../../../src/Yarhl.Examples/FileSystem/NodeExamples.cs?name=TransformChain)] +### Transform collections + +You can also apply a converter to a collection of nodes by using the following +extension methods: + +- `IEnumerable.TransformWith`: use the converter with all the nodes and + return an `IEnumerable`. + - Note that this has the same behavior as an `IEnumerable`: **the conversion + will not happen until the collection is iterated**. +- `NavigableNodeCollection.TransformCollectionWith`: use the converter + with all the nodes and returns the same collection. + - The conversion happens immediately. + +Only the overload that takes a converter instance `TransformWith(IConverter)` +will re-use the same converter for every node. The other overloads will create a +new converter for each node. + ## Tags Nodes can store additional metadata via the generic dictionary `Tags`. Each tag