FileStream.Read method

G

Guest

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
 
J

Jon Skeet [C# MVP]

Roby Eisenbraun Martins
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top