Click here to Skip to main content
15,909,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: Uploading already use file Pin
Eddy Vluggen8-Sep-11 10:34
professionalEddy Vluggen8-Sep-11 10:34 
GeneralRe: Uploading already use file Pin
MicroVirus8-Sep-11 13:07
MicroVirus8-Sep-11 13:07 
QuestionDirectShowNET Framework 4.0 and 2.0 Pin
semixor8-Sep-11 1:10
semixor8-Sep-11 1:10 
AnswerRe: DirectShowNET Framework 4.0 and 2.0 Pin
Eddy Vluggen8-Sep-11 7:00
professionalEddy Vluggen8-Sep-11 7:00 
GeneralRe: DirectShowNET Framework 4.0 and 2.0 Pin
semixor8-Sep-11 9:01
semixor8-Sep-11 9:01 
AnswerRe: DirectShowNET Framework 4.0 and 2.0 Pin
Eddy Vluggen8-Sep-11 9:11
professionalEddy Vluggen8-Sep-11 9:11 
QuestionIBasicVideo + NullRenderer ( How ? ) Pin
semixor8-Sep-11 0:50
semixor8-Sep-11 0:50 
AnswerRe: IBasicVideo + NullRenderer ( How ? ) Pin
MicroVirus8-Sep-11 4:49
MicroVirus8-Sep-11 4:49 
GeneralRe: IBasicVideo + NullRenderer ( How ? ) Pin
semixor8-Sep-11 5:52
semixor8-Sep-11 5:52 
GeneralRe: IBasicVideo + NullRenderer ( How ? ) Pin
MicroVirus8-Sep-11 13:28
MicroVirus8-Sep-11 13:28 
GeneralRe: IBasicVideo + NullRenderer ( How ? ) Pin
semixor9-Sep-11 3:20
semixor9-Sep-11 3:20 
QuestionDeep Linking between views when using PRISM Pin
Phillip Donegan7-Sep-11 21:46
Phillip Donegan7-Sep-11 21:46 
QuestionEF Repository Questions Pin
Matt U.7-Sep-11 11:00
Matt U.7-Sep-11 11:00 
GeneralRe: EF Repository Questions Pin
PIEBALDconsult7-Sep-11 18:10
mvePIEBALDconsult7-Sep-11 18:10 
GeneralRe: EF Repository Questions Pin
Matt U.8-Sep-11 2:35
Matt U.8-Sep-11 2:35 
GeneralRe: EF Repository Questions Pin
PIEBALDconsult8-Sep-11 3:10
mvePIEBALDconsult8-Sep-11 3:10 
AnswerRe: EF Repository Questions Pin
BobJanova8-Sep-11 3:40
BobJanova8-Sep-11 3:40 
GeneralRe: EF Repository Questions Pin
Matt U.8-Sep-11 4:37
Matt U.8-Sep-11 4:37 
QuestionBetter Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace7-Sep-11 7:59
NickPace7-Sep-11 7:59 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Pete O'Hanlon7-Sep-11 8:08
mvePete O'Hanlon7-Sep-11 8:08 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Ennis Ray Lynch, Jr.7-Sep-11 8:08
Ennis Ray Lynch, Jr.7-Sep-11 8:08 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
BillWoodruff7-Sep-11 19:37
professionalBillWoodruff7-Sep-11 19:37 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Dan Mos7-Sep-11 8:14
Dan Mos7-Sep-11 8:14 
NickPace wrote:
var someValue = someList.Where(kvp => kvp.Value.Equals(someStringValue)); // which doesn’t work

Not sure if it is a typo but you don't select anything in the line below

C#
var someValue = someList.Where(kvp => kvp.Value.Equals(someStringValue)); // which doesn’t work


It should be something like:
C#
var someValue = someList.Where(kvp => kvp.Value.Equals(someStringValue)).Select(kvp=>kvp).FirstOrDefault();


Than you could check if it exits simply by comparing someValue.Value with string.Empty.

If not found the FirstOrDefault() method will initialize it with the default values witch is string.Empty for strings.

But there are more speedier approaches to this such as Dictionary, HashTable...
All the best,

Dan

GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace7-Sep-11 9:12
NickPace7-Sep-11 9:12 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Matt U.7-Sep-11 11:02
Matt U.7-Sep-11 11:02 

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.