Re: MemoryStream.Write() Offset cannot be zero



Gravity <gravity@xxxxxxxxxx> wrote:
> I see... I think I might have some missunderstanding here. I have always
> compare to C/C++ -> memcpy( )
>
> If I am writting 5 parameter of int32 which each consist of 4 bytes into it.
>
> Does it mean the code should look like;
>
> MemoryStream.Write(paramA, 0, 4);
> MemoryStream.Write(paramB, 0, 4);
>
> MemoryStream.Write(paramC, 0, 4);
>
> MemoryStream.Write(paramD, 0, 4);
>
> MemoryStream.Write(paramE, 0, 4);
>
> where the write operation will be performed will automatically increased to
> the next location?

Absolutely. It's a *stream*, not an array. Imagine you were writing to
a file - it's just like that, except it all stays in memory.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Raise event inside a thread
    ... using monitors or a ManualResetEvent. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: get the actual size of a file
    ... saying for certain either way:) ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Threading/Locking
    ... Then you stash the data in an ordered list which is then processed by ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to trigger other thread
    ... updates are "seen" or not. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: How to delete some text in a file
    ... and then moving it over the top of the old one. ... > could read the whole of the old file into memory, ... > If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)

Loading