Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

TaxonomyFieldValueCollection.Exists() Method best use practice

$
0
0

For instance i have a TermSet with the following iems "Beaches", "Cities"

I am trying to filter TaxonomyFieldValueCollection using LINQ with Exist() method to see if the returned collection has items based on TaxonomyFieldValueCollection.

var thingsToDo = from feature in HomePageFeatures where feature.ItineraryTags.Exists(HasBeaches) select feature;
privatestaticbool HasBeaches(TaxonomyFieldValue s)
    {if (s.Label=="Beaches") 
      {returntrue;
      }else
      {returnfalse;
      }
    }

Drawback of this is that i have to predefine a string ( s.Label=="Beaches" ) in order for this to work.

Is there a better way to use Exist, where i can specify a string?

 


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>