How to optimize this code
Posted
by phenevo
on Stack Overflow
See other posts from Stack Overflow
or by phenevo
Published on 2010-03-17T16:16:16Z
Indexed on
2010/03/17
16:21 UTC
Read the original article
Hit count: 316
c#
|perfomance
Hi I class Car it has a property: string Code and 10 other.
common codes is list of strings(string[] ) cars a list of cars(Car[]) filteredListOfCars is List.
for (int index = 0; index < cars.Length; index++)
{
Car car = cars[index];
if (commonCodes.Contains(car.Code))
{
filteredListOfCars.Add(car);
}
}
Unfortunately this piece of methodexecutes too long.
I have about 50k records
How can I lower execution time??
© Stack Overflow or respective owner