c# how to add byte to byte array

前端 未结 6 628
梦毁少年i
梦毁少年i 2020-12-08 15:30

How to add a byte to the beginning of an existing byte array? My goal is to make array what\'s 3 bytes long to 4 bytes. So that\'s why I need to add 00 padding in the beginn

6条回答
  •  情话喂你
    2020-12-08 16:21

    Arrays can't be resized, so you need to allocte a new array that is larger, write the new byte at the beginning of it, and use Buffer.BlockCopy to transfer the contents of the old array across.

提交回复
热议问题