Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to merge all of the 11 arrays into one big array. All of the arrays have same number of elements and all the elements in each array correspond to the elements in other arrays. For example the first element of Days array corresponds to first element of Depths array, to first element of the IRIS_IDs array, to first element of the Latitudes array and so on.

When the merged array is displayed on Console screen it should look something like this: enter image description here

I am reading in the data into each array from separate text files that contain the corresponding data

*Edit - I need to make it so that I am able to search for all the data that corresponds to a specific month. For example if I choose to type in January, the Console will display all of the data that corresponds to January. So in this example all the data about the earthquakes that happened in January will be shown.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
218 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can create a class to aggregate all the fields which you want to display, then iterate through all the elements and for each iteration create a new instance of this class and add to a list. Something like:

Class Merge
{
   public int Days {get; set;}
   public int Depths {get; set;}
etc...
}

for (int i = 0; i < Days; i++)
{
   var merge = new Merge(){Days = Days[0], Depths = Depths[0], ...}

   mergedList.Add(merge);
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...