Most efficient way to append arrays in C#?

前端 未结 10 2183
挽巷
挽巷 2020-12-02 19:39

I am pulling data out of an old-school ActiveX in the form of arrays of doubles. I don\'t initially know the final number of samples I will actually retrieve.

What i

10条回答
  •  青春惊慌失措
    2020-12-02 20:28

    I recommend the answer found here: How do I concatenate two arrays in C#?

    e.g.

    var z = new int[x.Length + y.Length];
    x.CopyTo(z, 0);
    y.CopyTo(z, x.Length);
    

提交回复
热议问题