Class NodeExtensions
- Namespace
- Yarhl.FileSystem
- Assembly
- Yarhl.dll
Extension methods for nodes.
public static class NodeExtensions
- Inheritance
-
NodeExtensions
- Inherited Members
Methods
TransformCollectionWith(NavigableNodeCollection<Node>, Type, params object?[])
Iterate and transform the nodes in the collection with the given converter.
public static NavigableNodeCollection<Node> TransformCollectionWith(this NavigableNodeCollection<Node> nodes, Type converterType, params object?[] args)
Parameters
nodes
NavigableNodeCollection<Node>The collection of nodes to transform.
converterType
TypeThe type of the converter to use.
args
object[]Arguments for the constructor of the type if any.
Returns
- NavigableNodeCollection<Node>
This same collection.
Remarks
It creates a new instance of the converter for each node.
TransformCollectionWith(NavigableNodeCollection<Node>, IConverter)
Iterate and transform the nodes in the collection with the given converter.
public static NavigableNodeCollection<Node> TransformCollectionWith(this NavigableNodeCollection<Node> nodes, IConverter converter)
Parameters
nodes
NavigableNodeCollection<Node>The collection of nodes to transform.
converter
IConverterConvert to use.
Returns
- NavigableNodeCollection<Node>
The same collection.
Remarks
It re-uses the same converter instance for each node.
TransformCollectionWith<TConv>(NavigableNodeCollection<Node>)
Iterate and transform the nodes in the collection with the given converter.
public static NavigableNodeCollection<Node> TransformCollectionWith<TConv>(this NavigableNodeCollection<Node> nodes) where TConv : IConverter, new()
Parameters
nodes
NavigableNodeCollection<Node>The collection of nodes to transform.
Returns
- NavigableNodeCollection<Node>
The same collection.
Type Parameters
TConv
The type of the converter.
Remarks
It creates a new instance of the converter for each node. It performs the conversion inmediately, not IEnumerable-styled.
TransformWith(IEnumerable<Node>, Type, params object?[])
Creates a new IEnumerable to transform the nodes with the given converter.
public static IEnumerable<Node> TransformWith(this IEnumerable<Node> nodes, Type converterType, params object?[] args)
Parameters
nodes
IEnumerable<Node>The collection of nodes to transform.
converterType
TypeThe type of the converter to use.
args
object[]Arguments for the constructor of the type if any.
Returns
- IEnumerable<Node>
This same collection.
Remarks
It creates a new instance of the converter for each node.
TransformWith(IEnumerable<Node>, IConverter)
Creates a new IEnumerable to transform the nodes with the given converter.
public static IEnumerable<Node> TransformWith(this IEnumerable<Node> nodes, IConverter converter)
Parameters
nodes
IEnumerable<Node>The collection of nodes to transform.
converter
IConverterConvert to use.
Returns
- IEnumerable<Node>
The same collection.
Remarks
It re-uses the same converter instance for each node.
TransformWith<TConv>(IEnumerable<Node>)
Creates a new IEnumerable to transform the nodes with the given converter.
public static IEnumerable<Node> TransformWith<TConv>(this IEnumerable<Node> nodes) where TConv : IConverter, new()
Parameters
nodes
IEnumerable<Node>The collection of nodes to transform.
Returns
- IEnumerable<Node>
The same collection.
Type Parameters
TConv
The type of the converter.
Remarks
It creates a new instance of the converter for each node. It returns a new IEnumerable and will run the conversion when iterated.