C# convert from uint[] to byte[]

后端 未结 5 2038
[愿得一人]
[愿得一人] 2021-01-13 20:35

This might be a simple one, but I can\'t seem to find an easy way to do it. I need to save an array of 84 uint\'s into an SQL database\'s BINARY field. So I\'m using the fol

5条回答
  •  悲&欢浪女
    2021-01-13 21:01

    How about:

    byte[] byteArray = uintArray.SelectMany(BitConverter.GetBytes).ToArray();
    

    This'll do what you want, in little-endian format...

提交回复
热议问题