Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've created a helper dll and am trying to get to a certain directory in the media tree.
DynamicMedia mediaRoot = new DynamicMedia(-1);
var test = mediaRoot.Descendants().Where(x => x.Name == "Generic Hero Images");
Gives an error stating "The type of arguments for method 'umbraco.MacroEngines.DynamicNodeList.Where<T>(string, params object[])' cannot be inferred.
I get the same error if I use
var test = mediaRoot.Descendants().Where("Name == @0", "Generic Hero Images");
If you know how to get these working (or alternatively a better way to approach this) I'd be grateful.
In the past I have used the node id's as Constants but this seems fragile.
Thanks in advance.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Using Descendants and Where in helper dll's
I've created a helper dll and am trying to get to a certain directory in the media tree.
DynamicMedia mediaRoot = new DynamicMedia(-1);
var test = mediaRoot.Descendants().Where(x => x.Name == "Generic Hero Images");
Gives an error stating "The type of arguments for method 'umbraco.MacroEngines.DynamicNodeList.Where<T>(string, params object[])' cannot be inferred.
I get the same error if I use
var test = mediaRoot.Descendants().Where("Name == @0", "Generic Hero Images");
If you know how to get these working (or alternatively a better way to approach this) I'd be grateful.
In the past I have used the node id's as Constants but this seems fragile.
Thanks in advance.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.