Array concatenation in C#

后端 未结 4 1179
故里飘歌
故里飘歌 2020-12-11 19:48
  1. How do I smartly initialize an Array with two (or more) other arrays in C#?

    double[] d1 = new double[5];
    double[] d2 = new double[3];
    double[] dTota         
    
    
            
4条回答
  •  醉梦人生
    2020-12-11 20:20

    using System.Linq;
    
    int[] array1 = { 1, 3, 5 };
    int[] array2 = { 0, 2, 4 };
    
    // Concat array1 and array2.
    var result1 = array1.Concat(array2).ToArray();
    

提交回复
热议问题