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: 150

Filed under:
|
|
|

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 !

  1. foreach (string[] s in ArrangList1)

  2. {

  3. int freq1 = int.Parse(s[1]);

  4. foreach (string[] s1 in ArrangList)

  5. {

  6. int freq2 = int.Parse(s1[1]);

  7. if (freq1 < freq2)

  8. {

  9. backup = s;

  10. index1 = ArrangList1.IndexOf(s);

  11. index2 = ArrangList.IndexOf(s1);

  12. ArrangList[index1] = s1;

  13. ArrangList[index2] = s;

  14. }

  15. backup = null;

  16. }

  17. }

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

Related posts about c#

Related posts about loop