c# - How to iterate over two arrays at once? -


I have two arrays created during parse text file. The first column names are included, the second contains the values ​​from the existing row, to create a map, I need to iterate on both lists at once. I currently have the following:

  var Currentview = current rouge Split (separator); Var valueAnnamter = Current value Getannamator (); Forex currency (column column in column list) {valueEnumerator.MoveNext (); ValueMap.Add (column, (string) valueEnumerator.Current); }  

It works just fine, but it does not satisfy my sense of beauty completely, and it becomes really hairy if the number of arrays is more than two (As I have to do sometimes). Does anyone have another, noble phrase?

If the column names have the same number as the elements are in each line, do not you use the loop can do?

  var current value = current royal. Split (separator); (Var i = 0; i & lt; columnList.Length; i ++) {// I (or all) arrays used in the index and build your map}  

Comments