Adding/summing two arrays

前端 未结 5 1330
抹茶落季
抹茶落季 2021-01-31 02:51

I\'ve encountered a purely hypothetical problem which feels like it has an easy solution if I find the right linq method...

I have two arrays of ints and I know they are

5条回答
  •  执笔经年
    2021-01-31 03:08

    public static int[] AddArrays(int[] a, int[] b)
    
    {
         return a.Zip(b, (x,y) => x+y).ToArray();
    }
    

提交回复
热议问题