Sep 19, 2009

Using linq query to get the data from the list or any collection

LINQ that allows to query SharePoint lists or any collection using familiar LINQ syntax. LINQ stands for Language Integrated Query and is one of the core features of Microsoft's .NET Framework 3.5 release.

In this example we are querying the web feature collection by using this query

SPFeatureCollection webFeatureColl = web.Features;

var webActivatedFeatureresults = from SPFeature feature in webFeatureColl

where feature.Definition.DisplayName == featureToActivate

select feature;

List<SPFeature> webActivatedFeature = webActivatedFeatureresults.ToList<SPFeature>();

Same way we can query the list collection.this is faster than query the list collection using the CAML query.

More on Linq will be next post.If you have any important stuff to share regarding the same,then keep posting

Enjoy coding !!!

No comments:

Post a Comment