Gravity
Mon Jun 06 09:20:12 CDT 2005
Thanks Jon, I think the MemoryStream should be able to do what I want.
I am a bit dissapointed on the C# .net, almost everything I learn in C/C++
cannot be used.
Since the name C#, sometime I hope they are more C/C++ friendly. But I do
understand it is due to the different architecture.
Thanks again.
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1d0cfeee891bb37b98c26d@msnews.microsoft.com...
> Peter Foot [MVP] <feedback@nospam-inthehand.com> wrote:
>> Take a look at the System.BitConverter which contains a number of methods
>> for extracting numerical types out of byte arrays, and getting the byte
>> array representation of numbers that can be copied in.
>
> Note that if you want to copy lots of things into the same array, it
> may be more efficient to use a MemoryStream and BinaryWriter, as
> BitConverter will always create a new byte array for each thing it is
> asked to convert to bytes.
>
> I have my own version of BitConverter (which allows either endianness,
> although it's irrelevant here) which allows you to copy the bytes into
> an existing byte array.
>
> See
http://www.pobox.com/~skeet/csharp/miscutil
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too