Sin Yee

Sin Yee

  • NA
  • 145
  • 74.9k

how to convert back to array

Apr 5 2011 10:59 AM
hi...i finish my intersection now. I need to convert the output back to the array. I also need to arrange them in 
the original form.
Before the intersection:
1 2 
1 2 3
1 2 3 4
1 3
1 3 4
....

Now my output is like this:
2
1
2
1
3
2
1
3
4
1
3
1
3
4

i need to restore output in array and make them become like this:
my expected output that i want:
2 1
2 1 3
2 1 3 4
1 3
1 3 4
..
here is my coding:
 for (int i = 0; i < myArray1.Count; i++)
           {
               foreach (string t in myArray1[i].ToString().Split(' '))
               {
                   //ItemKey.AppendText(t);
                   hs3.Add(t);
               }
               var clone = new HashSet<string>(hs2);
               hs2.IntersectWith(hs3);
               foreach (string y in hs2)
               {
                   ItemKey.AppendText(y);
               }

               hs2 = clone;
               hs3.Clear(); 
              
           }
What should i need to do...to make my output become like this...hope someone can help me.thanks ya...



Answers (1)