- Max throttling
- Performance with large list
SPListItemCollection collection = list.Items;
DataView view = new DataView(collection.GetDataTable());
DataTable result = view.ToTable(true, "[Column Name"]);
By using DataView and DataTable we can get the distinct value from list, but if it's a large list you only get Max Throtting items in a collection, others will be missing. The most important thing is this way is easy to use.
IEnumerable enumerable = list.Items.Cast<SPListItem>().Select(itm => itm["Column Name"]).Distinct();
Or you can use Linq to select the distinct value, this way will not be recommend because of performance but it will return exactly data if the maximum return records were not exceeded the Max Throttling.
It's up to you to choose any way, but hope this help.
No comments:
Post a Comment