I'm a Electronic Engineer.
I have a strugle in a program I made for an Windows Form Application in C# and I need your help to deal with it. I have two Lists of strings [num] and [work] with the same size and each value of [num] corresponds to [work] like this:
num work
11 0,4
23 0,5
36 0,333
49 13
...
Then I have the List of strings [lnum] wich is almost like [num] but with less numbers like this:
lnum
23
36
49
...
And What I want to do is to get the correspond value to the numbers that exists in the lnum like this:
lnum lwork
23 0,5
36 0,333
49 13
...
My code to do so that I've developed is this:
List<string> num = new List<string>();
List<string> work = new List<string>();
List<string> lnum = new List<string>();
List<double> lwork = new List<double>();
for (int i = 0; i < num.Count; i++)
{
for (int j = 0; j < lnum.Count; j++)
{
if(lnum[j] == num[i])
{
lwork.Add(Convert.ToDouble(work[j].ToString()));
}
}
}
Now the problem is that It seems I'm not doing it in the rigth way if the Lists of numbers have a lot of variables. What I'm doing wrong? What is the best way to do this? What changes of my code I need to make?
If you need further more explanation I'll try to explain with more detail. Sorry for any mistake in English, I'm Portuguese and English is not my nature language and I apolagyse if the title doesn't describe better my struggle.
I really really need your help people, and I'll be forever grateful for your help. I hope the best weekend for all of you!