Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
GeneralRe: Screenshots Pin
Judah Gabriel Himango3-Aug-06 4:21
sponsorJudah Gabriel Himango3-Aug-06 4:21 
Questionhow to create a color eyedroppper? Pin
relsirc2-Aug-06 4:36
relsirc2-Aug-06 4:36 
AnswerRe: how to create a color eyedroppper? Pin
Ennis Ray Lynch, Jr.2-Aug-06 4:42
Ennis Ray Lynch, Jr.2-Aug-06 4:42 
Questionhow to remove duplicate characters from a text file [modified] Pin
vp152-Aug-06 4:35
vp152-Aug-06 4:35 
AnswerRe: how to remove duplicate characters from a text file Pin
Ennis Ray Lynch, Jr.2-Aug-06 4:44
Ennis Ray Lynch, Jr.2-Aug-06 4:44 
QuestionClass doesn't support Automation [modified] Pin
Lupson2-Aug-06 4:21
Lupson2-Aug-06 4:21 
QuestionHow to set zoom in WebBrowser? Pin
Dima Filipiuk2-Aug-06 3:46
Dima Filipiuk2-Aug-06 3:46 
QuestionCompare values with List Pin
abnorm2-Aug-06 3:30
abnorm2-Aug-06 3:30 
Hi,

I have two generic Lists of data and I want to compare the values.

Fill the mappinglist we want to compare the sourcelist with
            <br />
List<MappingItem> MappingList = new List<MappingItem>();<br />
MappingList.Add(new MappingItem("11", "1"));<br />
MappingList.Add(new MappingItem("22", "2"));<br />
//leave out for test  MappingList.Add(new MappingItem("33", "3"));<br />
MappingList.Add(new MappingItem("44", "4"));<br />
MappingList.Add(new MappingItem("55", "5"));<br />


Fill the Sourcelist we want to deal with
<br />
List<SourceItem> SourceList = new List<SourceItem>();<br />
SourceList.Add(new SourceItem("11", "Value one"));<br />
SourceList.Add(new SourceItem("22", "Value two"));<br />
SourceList.Add(new SourceItem("33", "Value three"));<br />
SourceList.Add(new SourceItem("44", "Value four"));<br />
SourceList.Add(new SourceItem("55", "Value five"));<br />


Make a instance of the DestinationList and the Itemobject
<br />
List<DestinationItem> DestinationList = new List<DestinationItem>(); <br />
DestinationItem destItem;<br />


Here is the problem Im stuck with. How shall I compare the values between these lists in a high performance way och with nice methods?


This is a uncomplete way, maybe u have a better method but I hope you understand what Im looking for!?!

<br />
<br />
foreach (MappingItem mappItem in MappingList.FindAll(new Predicate<MappingItem>(???)))<br />
{<br />
  destItem = new DestinationItem(mappItem.DestId,"?SourceItem.Value?");<br />
  DestinationList.Add(destItem);<br />
}<br />
<br />


Write the output
<br />
            DestinationList.ForEach(delegate(DestinationItem d)<br />
            { Console.WriteLine("DestId: {0}, Value: {1}", d.DestId, d.Value); });<br />


Output result:
DestId: 1, DestValue: value one
DestId: 2, DestValue: value two
DestId: 4, DestValue: value four
DestId: 5, DestValue: value five


I hope I make my self clearSmile | :)
//Albin
AnswerRe: Compare values with List [modified] Pin
Wjousts2-Aug-06 3:48
Wjousts2-Aug-06 3:48 
AnswerRe: Compare values with List Pin
Ingo2-Aug-06 3:48
Ingo2-Aug-06 3:48 
GeneralRe: Compare values with List Pin
Wjousts2-Aug-06 4:01
Wjousts2-Aug-06 4:01 
GeneralRe: Compare values with List Pin
abnorm2-Aug-06 4:13
abnorm2-Aug-06 4:13 
GeneralRe: Compare values with List Pin
Wjousts3-Aug-06 3:23
Wjousts3-Aug-06 3:23 
GeneralRe: Compare values with List Pin
Ingo2-Aug-06 4:19
Ingo2-Aug-06 4:19 
GeneralRe: Compare values with List Pin
abnorm2-Aug-06 4:32
abnorm2-Aug-06 4:32 
GeneralRe: Compare values with List Pin
Ingo2-Aug-06 5:47
Ingo2-Aug-06 5:47 
Questionhow to draw ractangle in picturebox at runtime manually Pin
kalaveer2-Aug-06 3:18
kalaveer2-Aug-06 3:18 
AnswerRe: how to draw ractangle in picturebox at runtime manually Pin
Wjousts2-Aug-06 3:24
Wjousts2-Aug-06 3:24 
AnswerRe: how to draw ractangle in picturebox at runtime manually Pin
stancrm2-Aug-06 3:29
stancrm2-Aug-06 3:29 
QuestionGetting C# to pull Outlook e-mail when computer is locked Pin
matt23lucier2-Aug-06 3:04
matt23lucier2-Aug-06 3:04 
AnswerRe: Getting C# to pull Outlook e-mail when computer is locked Pin
Corinna John2-Aug-06 3:52
Corinna John2-Aug-06 3:52 
GeneralRe: Getting C# to pull Outlook e-mail when computer is locked Pin
matt23lucier2-Aug-06 7:32
matt23lucier2-Aug-06 7:32 
QuestionDelete Registry settings in uninstall Pin
Saamir2-Aug-06 2:47
Saamir2-Aug-06 2:47 
AnswerRe: Delete Registry settings in uninstall Pin
Dustin Metzgar2-Aug-06 4:17
Dustin Metzgar2-Aug-06 4:17 
QuestionRe: Delete Registry settings in uninstall Pin
Saamir2-Aug-06 4:37
Saamir2-Aug-06 4:37 

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.