Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stephen Balmer 18 posts 38 karma points
    Nov 16, 2012 @ 18:03
    Stephen Balmer
    0

    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.

  • 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.

Please Sign in or register to post replies