Hi,

Do you know how the method FileStream.Read populate the Char array if
we don't use out or ref?

Thank you,
Roby Eisenbraun Martins

Re: FileStream.Read method by Jon

Jon
Sun Jun 05 15:13:47 CDT 2005

Roby Eisenbraun Martins
<RobyEisenbraunMartins@discussions.microsoft.com> wrote:
> Do you know how the method FileStream.Read populate the Char array if
> we don't use out or ref?

(I assume you either mean a byte array, or you're using managed C++ -
streams don't deal with characters, they deal with bytes.)

Because arrays are reference types. When you pass an array, you're
actually passing a reference to the array. The method call can change
the contents of the array without changing the value of your variable.

See http://www.pobox.com/~skeet/csharp/parameters.html for more
information.

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