Perhaps I would consider using the IndexOf () method as follows:
foreach(DataRow m_row in base_rows)
Company nu = new Company(m_row, symb_rows.IndexOf(m_row));
You may need to use Array.IndexOf () instead, this worked in VBNET2008 since I am working with it now, but I have not tested it in C #.
For Each DataRow m_row in base_rows
Company nu = New Company(m_row, symb_rows(Array.IndexOf(symb_rows, m_row)))
Next
So I could suggest the following in C #.
foreach (DataRow m_row in base_rows)
Company nu = new Company(m_row, symb_rows[Array.IndexOf(symb_rows, m_row)]);
Otherwise, you can use instead of for (;;) instead, sometimes it's better to do it.
for(int index = 0; index < base_rows.Length && index < symb_rows.Length; ++index)
Company nu = new Company(base_rows[index], symb_rows[symb_rows.IndexOf(base[index])]);
I do not know what you prefer.
source
share