Re: Searching List<T>, how to make it faster
- From: "Paul" <paulriley@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 May 2009 14:00:29 +0100
Is this DB populated?
I suggest you need to revist your design. Your best bet would be to populate
your list based on a DB query with a parameter called name.
Select * from Table where Name like 'x%'
alternatively you could try linq or the entity framework.
"M.H." <mh@xxxxxxxxx> wrote in message
news:%23MEVW243JHA.1864@xxxxxxxxxxxxxxxxxxxxxxx
I have List<T> with about 6000-7000 objects.
I need to select all objects that the property Name starts with
SearchText.
This is the code
foreach (T item in myList)
if (item.Name.StartsWith(SearchText))
myResults.Add(item);
It takes about 5-6 seconds and my users are not happy with the speed.
How to improve it?
I tried "for (int.." but the result was the same.
Thanks
MH
.
- Follow-Ups:
- Re: Searching List<T>, how to make it faster
- From: M.H.
- Re: Searching List<T>, how to make it faster
- References:
- Searching List<T>, how to make it faster
- From: M.H.
- Searching List<T>, how to make it faster
- Prev by Date: Re: USING statement
- Next by Date: Re: Searching List<T>, how to make it faster
- Previous by thread: Searching List<T>, how to make it faster
- Next by thread: Re: Searching List<T>, how to make it faster
- Index(es):
Relevant Pages
|