Conversion from List to array T[]

后端 未结 7 1096
一向
一向 2020-11-27 18:28

Is there a short way of converting a strongly typed List to an Array of the same type, e.g.: List to MyClass[]

7条回答
  •  日久生厌
    2020-11-27 18:42

    One possible solution to avoid, which uses multiple CPU cores and expected to go faster, yet it performs about 5X slower:

    list.AsParallel().ToArray();
    

提交回复
热议问题