Click here to Skip to main content
15,891,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Matt U.7-Sep-11 13:12
Matt U.7-Sep-11 13:12 
QuestionRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
MicroVirus8-Sep-11 4:34
MicroVirus8-Sep-11 4:34 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Abhinav S7-Sep-11 8:26
Abhinav S7-Sep-11 8:26 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Ian Shlasko7-Sep-11 10:06
Ian Shlasko7-Sep-11 10:06 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
PIEBALDconsult7-Sep-11 14:25
mvePIEBALDconsult7-Sep-11 14:25 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Mehdi Gholam7-Sep-11 20:05
Mehdi Gholam7-Sep-11 20:05 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? [modified] Pin
BillWoodruff7-Sep-11 20:38
professionalBillWoodruff7-Sep-11 20:38 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace8-Sep-11 3:40
NickPace8-Sep-11 3:40 
Thanks! That's good information you provided. Overall I am pleasantly surprised and pleased with the responses to my initial questions. Everyone provided some good ideas and I even learned a couple new things concerning LINQ.

This issue started out as a minor client-requested enhancement to one of their existing applications (hopefully just a one-time deal), and when I looked at the code in question I discovered the data I needed to compare against already existed in a List of KeyValuePairs, so really no need to query the database again. And thus my little quest began. When I saw the first response from Pete O'Hanlon, I thought: "Of course. I'll just cast the List to an equivalent Dictionary object and use its 'ContainsValue' method." Which I thought was going to work because it compiled just fine, but then threw an 'Invalid Cast' exception during runtime (same thing for a HashTable). Sigh | :sigh: And so the quest continued...

I eventually went with the answer provided by MDL=>Moshu. It works great. The List has about 2000 KeyValuePairs in it and the new search appears instantaneous to the end users. So though the code design may not be ideal, it works, it's stable, it performs well, and the client is happy. And that is what it is really all about.
-NP

Never underestimate the creativity of the end-user.

QuestionC#.net expiration date Pin
classy_dog7-Sep-11 5:30
classy_dog7-Sep-11 5:30 
AnswerRe: C#.net expiration date Pin
GParkings7-Sep-11 5:37
GParkings7-Sep-11 5:37 
GeneralRe: C#.net expiration date Pin
classy_dog7-Sep-11 5:51
classy_dog7-Sep-11 5:51 
GeneralRe: C#.net expiration date Pin
GParkings7-Sep-11 6:20
GParkings7-Sep-11 6:20 
GeneralRe: C#.net expiration date Pin
kribo9-Sep-11 5:01
professionalkribo9-Sep-11 5:01 
Questionout of memory ! Pin
mersad007-Sep-11 4:34
mersad007-Sep-11 4:34 
AnswerRe: out of memory ! Pin
GParkings7-Sep-11 4:45
GParkings7-Sep-11 4:45 
AnswerRe: out of memory ! Pin
Pete O'Hanlon7-Sep-11 5:01
mvePete O'Hanlon7-Sep-11 5:01 
AnswerRe: out of memory ! Pin
#realJSOP7-Sep-11 7:23
mve#realJSOP7-Sep-11 7:23 
AnswerRe: out of memory ! Pin
Daniel.Grondal7-Sep-11 22:43
Daniel.Grondal7-Sep-11 22:43 
QuestionThread.join Pin
benams7-Sep-11 0:28
benams7-Sep-11 0:28 
AnswerRe: Thread.join PinPopular
Pete O'Hanlon7-Sep-11 0:57
mvePete O'Hanlon7-Sep-11 0:57 
QuestionAre thre Mutex's that can be used in Silverlight? Pin
Xarzu6-Sep-11 7:59
Xarzu6-Sep-11 7:59 
AnswerRe: Are thre Mutex's that can be used in Silverlight? Pin
Pete O'Hanlon6-Sep-11 8:23
mvePete O'Hanlon6-Sep-11 8:23 
AnswerRe: Are thre Mutex's that can be used in Silverlight? Pin
Abhinav S6-Sep-11 19:34
Abhinav S6-Sep-11 19:34 
QuestionWhat is the Regular expression that detects a $ sign and digits in html code Pin
Member 82168286-Sep-11 7:21
Member 82168286-Sep-11 7:21 
AnswerRe: What is the Regular expression that detects a $ sign and digits in html code Pin
Pete O'Hanlon6-Sep-11 7:28
mvePete O'Hanlon6-Sep-11 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.