Copied to clipboard

Flag this post as spam?

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


  • Jamie Attwood 208 posts 504 karma points c-trib
    Jul 21, 2014 @ 23:58
    Jamie Attwood
    0

    System.Collections.Generic.List<umbraco.MacroEngines.DynamicNode>' does not contain a definition for 'Any'

    In umbraco 6.1.6 If I define a node like this:

    var searchResults = Library.NodeById(1052);

    Then later declare a DynamicNode to add additional nodes to the search results like this:

    List<DynamicNode> newSearchResults = new List<DynamicNode>();
    newSearchResults.Add(somenewitem);
    searchResults = newSearchResults;
    

    At runtime I can't access any methods like Any() or Count. I see errors like this

    System.Collections.Generic.List<umbraco.MacroEngines.DynamicNode>' does not contain a definition for 'Any'

     When I initially define a variable like this: var searchResults = Library.NodeById(1052); what type is it initialized as AND how would I create this strictly and use it instead of DynamicNode?

    Please advise it's driving me insane! Thanks!

     

     

     

     

     

     

     

  • Benas Brazdziunas 34 posts 156 karma points c-trib
    Jul 22, 2014 @ 16:04
    Benas Brazdziunas
    0

    Hi

    Any() is System.Linq extention so you need have reference to System.Core and System.Linq

    code works for me:

                var sss = new List<DynamicNode>();
                var result = sss.Any(c => c.GetProperty<bool>("checked") == true);
    
  • Jamie Attwood 208 posts 504 karma points c-trib
    Jul 22, 2014 @ 16:25
    Jamie Attwood
    0

    Thanks! Previously I was defining my empty node list as this:

    List<DynamicNode> searchResults = new List<DynamicNode>();

    But after hours of hair pulling just ended up finally defining it as this (which I am asuming is the implicit way the umbraco does it)

    var newSearchResults = new umbraco.MacroEngines.DynamicNodeList();
Please Sign in or register to post replies

Write your reply to:

Draft