Converting a list of ints to a byte array

后端 未结 4 2061
旧巷少年郎
旧巷少年郎 2021-01-17 12:26

I tried to use the List.ConvertAll method and failed. What I am trying to do is convert a List to byte[]

I copped out and went

4条回答
  •  清歌不尽
    2021-01-17 13:14

    The ConvertAll method is flawed because it expects there to be a 1:1 mapping from the source to the destination. This is not true when converting integers to bytes. You are much better off going with a solution such as what @SLaks has suggested with the SelectMany extension method.

提交回复
热议问题