c# - object does not contain a definition for 'Skip' Umbraco razor -
i'm trying sort nodes first letter, , page them in razor.(umbraco). "object not contain definition 'skip'" error when hits foreach.
pagestolist = homenode.children.orderby("name"); ienumerable<dynamicnode> nl = @homenode.children.items; pagestolist = nl.where(x => x.name.startswith(currentletter));
this @pagestolist outputs:
system.linq.enumerable+wherelistiterator`1[umbraco.macroengines.dynamicnode] foreach(dynamic item in pagestolist.skip(1){ }
you possibly using wrong property. if after nodes below homenode, don't use items property. also, try not cast objects. c# has effective var object. assuming homenode dynamicnode, might worth trying following:
pagestolist = homenode.children.orderby("name").where(x => x.name.startswith(currentletter));
then code should work. please note again using var because want object declared @ compile-time, instead of using dynamic, should when accessing unknown, or dynamic, properties pagestolist object):
foreach(var item in pagestolist.skip(1)){ }
so summarise, looks code using property "items", gave array of dynamicnode[] instead of ienumerable object.
i hope helps out. luck!
Comments
Post a Comment