Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
Fast Lookup in List
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Robert
16y
6.9k
1
Reply
Hi everyone,
i've got a problem using Generic.List. I'm currently writing a program which has to deal with a lot
of data stored in a Generic.List. I often need to search through the list to find out if a new item
is already stored in the list. This is no problem beacause of the Contains-Method. The problem
is this method is very slow and the processing has to be very fast. I've come up with writing an
anonymous function which does the seacrhing for me whcih is way faster. looking like this:
col = getNewColor();
if (!colors.Exists(delegate(Color c) { return c == col; }))
{
colors.Add(col);
}//
This is also not that fast, concerning what I need for my programm.
Is there any way
to speed-up a search through a list?
I appreciate any help.
Greetings LeRoi
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
arraylist .Clear Help me plz
email or tel checking