I'm not sure there's a way to do this using IsEven - unless you loop through all the items and run a check inside the loop (ie is c.IsEven() { ... } ).
There is a way you can do this in pure C# though (see this thread) if you use ChildrenAsList, something like this should work:
var appItems = ((DynamicNode)Model).ChildrenAsList; foreach (var c in appItems.Where((x, c) => c % 2 == 1)) { }
foreach with Where statement to check IsEven()
Does somebody know the solution for a foreach loop for showing only the even (isEven()) items?
Current code doesn't work:
Hi,
I'm not sure there's a way to do this using IsEven - unless you loop through all the items and run a check inside the loop (ie is c.IsEven() { ... } ).
There is a way you can do this in pure C# though (see this thread) if you use ChildrenAsList, something like this should work:
HTH,
Tom
is working on a reply...