convert int[] to byte[]
- From: "Mimi" <Mimi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 02:31:01 -0700
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.
.
- Follow-Ups:
- Re: convert int[] to byte[]
- From: Jon Skeet [C# MVP]
- Re: convert int[] to byte[]
- From: Richard Kure
- Re: convert int[] to byte[]
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: convert int[] to byte[]
- Prev by Date: Are arguments passed to a function contained in an array object?
- Next by Date: Re: Casting of derived classes
- Previous by thread: Are arguments passed to a function contained in an array object?
- Next by thread: Re: convert int[] to byte[]
- Index(es):
Relevant Pages
|