Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-185.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 994e0d5aceec6401dcd4d67a4a00f945f94ad334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class App {
  public static void Main() {
    FP.appendArrays(new int[] {1, 2}, new int[] {3, 4});
  }
}

class FP {
    public static T[] appendArrays<T>(params T[][] arrays) {
      int length = 0;
      foreach (T[] array in arrays)
        length += array.Length;
      T[] result = new T[length];
      int k = 0;
      foreach (T[] array in arrays)
        foreach (T obj in array) {
          result[k] = obj;
          k++;
        }
      return result;
    }
}