Technically speaking, that method is for internal use.. since it's not as straight forward as you might think to use. Be aware that Descendants is slow, though I have plans to optimise it for 4.7.2
In my version of the code, the parameter is DynamicBackingItem which is the 4.7.1 signature (since a DynamicNode can be Media or Content now)
How do I use Descendants (Func< INode, bool > func)
Does anyone have an example of how to use this method:
@Model.Descendants(Func< INode, bool > func)
Technically speaking, that method is for internal use.. since it's not as straight forward as you might think to use.
Be aware that Descendants is slow, though I have plans to optimise it for 4.7.2
In my version of the code, the parameter is DynamicBackingItem which is the 4.7.1 signature (since a DynamicNode can be Media or Content now)
Here's a sample:
@using umbraco.MacroEngines;
@{
Func<DynamicBackingItem,bool> predicate = delegate(DynamicBackingItem node) { return node.NodeTypeAlias == "TextPage"; };
Func<DynamicBackingItem,bool> predicate2 = delegate(DynamicBackingItem node) { string bodyText = node.GetPropertyValue("bodyText"); return bodyText != null && bodyText.Contains("lorem"); };
<ul>
@foreach(var item in @Library.NodeById(-1).Descendants(predicate))
{
<li>@item.Name</li>
}
</ul>
<ul>
@foreach(var item in @Library.NodeById(-1).Descendants(predicate2))
{
<li>@item.Name</li>
}
</ul>
}
is working on a reply...