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

C#

 
AnswerRe: Spinning Roulette Wheel Pin
Alan Balkany14-Sep-11 5:26
Alan Balkany14-Sep-11 5:26 
GeneralRe: Spinning Roulette Wheel Pin
stephen.darling15-Sep-11 2:30
stephen.darling15-Sep-11 2:30 
GeneralRe: Spinning Roulette Wheel Pin
Alan Balkany15-Sep-11 4:17
Alan Balkany15-Sep-11 4:17 
GeneralRe: Spinning Roulette Wheel Pin
stephen.darling15-Sep-11 4:34
stephen.darling15-Sep-11 4:34 
QuestionComparing 2 lists Pin
nitin_ion8-Sep-11 3:12
nitin_ion8-Sep-11 3:12 
AnswerRe: Comparing 2 lists Pin
PIEBALDconsult8-Sep-11 3:15
mvePIEBALDconsult8-Sep-11 3:15 
AnswerRe: Comparing 2 lists Pin
BobJanova8-Sep-11 3:29
BobJanova8-Sep-11 3:29 
AnswerRe: Comparing 2 lists Pin
Wayne Gaylard8-Sep-11 4:08
professionalWayne Gaylard8-Sep-11 4:08 
Just use a First query on the end of your Where query like this

C#
foreach(var p in list1.Count()>list2.Count() ? list2:list1 )
             {
                 var u=list2.Where(x => x.ID == p.ID || x.Empname == p.Empname ).FirstOrDefault();
             }


and that will return the first such emp. I use FirstOrDefault() in case there are no matches it will return a null Emp instead of throwing an Exception if there are no matches.

You need to look out if List2 is longer than List1 as you will then be matching List2 to List2 here list2.Where.

Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

AnswerRe: Comparing 2 lists Pin
Daniel.Grondal8-Sep-11 21:46
Daniel.Grondal8-Sep-11 21:46 
QuestionUploading already use file Pin
sarang_k8-Sep-11 1:34
sarang_k8-Sep-11 1:34 
AnswerRe: Uploading already use file Pin
BobJanova8-Sep-11 1:49
BobJanova8-Sep-11 1:49 
GeneralRe: Uploading already use file Pin
sarang_k8-Sep-11 2:11
sarang_k8-Sep-11 2:11 
GeneralRe: Uploading already use file Pin
MicroVirus8-Sep-11 5:00
MicroVirus8-Sep-11 5:00 
GeneralRe: Uploading already use file Pin
BobJanova8-Sep-11 6:12
BobJanova8-Sep-11 6:12 
GeneralRe: Uploading already use file Pin
Eddy Vluggen8-Sep-11 6:53
professionalEddy Vluggen8-Sep-11 6:53 
GeneralRe: Uploading already use file Pin
BobJanova8-Sep-11 10:25
BobJanova8-Sep-11 10:25 
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 

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.