i’d like to limit the return of this code:
Listx.AddRange(suggestions.Where(x => x.Contains(content)));
so, that only less than 7 items will be added. tried it like this way, but it doesnt feel right, and its pretty slow because listx containsup to 100 entrys.
Listx.AddRange(suggestions.Where(x => x.Contains(content)&&Listx.Count <= 6));
anybody got some hints to improve the performance of the second piece of code? It’s used everytime the text-changed event of a textbox is fired, so it shouldn’t delay the input.
You can use the Enumerable.Take method to limit the results from any Linq query.
If I were you would get familiarised with the 101 Samples for Linq, there you will find examples for every operation available on the Linq framework.