looping array inside list in c#
Posted
by 3yoon af
on Stack Overflow
See other posts from Stack Overflow
or by 3yoon af
Published on 2010-05-11T17:42:21Z
Indexed on
2010/05/11
17:44 UTC
Read the original article
Hit count: 169
I have a list of array that contains multiple arrays. each array has 2 index .. First, I want to loop the list. Then i want to loop the array inside the list .. How can i do that ? I try to use this way, but it doesn't work !
foreach (string[] s in ArrangList1)
{
int freq1 = int.Parse(s[1]);
foreach (string[] s1 in ArrangList)
{
int freq2 = int.Parse(s1[1]);
if (freq1 < freq2)
{
backup = s;
index1 = ArrangList1.IndexOf(s);
index2 = ArrangList.IndexOf(s1);
ArrangList[index1] = s1;
ArrangList[index2] = s;
}
backup = null;
}
}
it give me error in line 4..
I try to do the loop using other way .. but i don't know how to continue !
for (int i = 0; i < ArrangList1.Count; i++)
{ for (int j = 0; j < ArrangList1[i].Length; j++) { ArrangList1[i][1]; } }
I use C# language .. Can someone help me, please?
© Stack Overflow or respective owner