Combine two double jagged array in one jagged array in C#

I'm doing my project and I'm facing to a problem with combining two jagged arrays and create one.

Below is a example: Jagged one :

double[][] JaggedOne=
{
    new double[] { -5, -2, -1 },
    new double[] { -5, -5, -6 },

};

and below is my second one:

double[][] JaggedTwo=
{
    new double[] {1, 2, 3 },
    new double[] { 4, 5, 6 },
};

Now as a result I want this:

double[][] Result =
{
    {-5,-2,-1},
    {-5,-5,-6},
    {1,2,3},
    {4,5,6},
};

Actually the first one im loading from the XML file and the second one and it is my training set and the second one is my sample test for using in machine learning . I really appreciate for your reply and tips.

Jon Skeet
people
quotationmark

The fact that they're jagged arrays is actually irrelevant here - you've really just got two arrays which you want to concatenate. The fact that the element type of those arrays is itself an array type is irrelevant. The simplest approach is to use LINQ:

double[][] result = jaggedOne.Concat(jaggedTwo).ToArray();

people

See more on this question at Stackoverflow