G
Guest
Is there a way to convert int[] to byte[] easily?
I want to write my int[] indexTbl to a MemoryStream but the MemoryStream
class only accepts byte[] buffer. I have more than one int[] indexTbl to
write to the stream so it would be nice if I could just write the whole int[]
as a block and then read it back later when needed.
I thought the Buffer class might be handy here but it seems to be best for
converting byte[] to int[] with Block Copy.
Any suggestions here. I am new to C# and wanted to avoid a for-loop and
convert each int to a byte and then write to the stream one by one.
I want to write my int[] indexTbl to a MemoryStream but the MemoryStream
class only accepts byte[] buffer. I have more than one int[] indexTbl to
write to the stream so it would be nice if I could just write the whole int[]
as a block and then read it back later when needed.
I thought the Buffer class might be handy here but it seems to be best for
converting byte[] to int[] with Block Copy.
Any suggestions here. I am new to C# and wanted to avoid a for-loop and
convert each int to a byte and then write to the stream one by one.