G
Gene
I'm not sure I understand this behavior (at least in the context of C#).
I understand the use of "ref" and "out" keywords as they apply to method
arguments, and then something this morning stopped me in my tracks. I must
have used FileStream.Read a thousand times and it never dawned on me that I
never have to specify either an "out" or "ref" when I pass the byte array
that I pass to this function- yet it returns the bytes read from the file.
The documentation (msdn) further confused me because they show an "in"
keyword as part of the method definition... how does "in" fit into this?
[C#]
public override int Read(
in byte[] array,
int offset,
int count
);
In C++ arrays and structures are "passed" by pointer- is this what C# is
doing for me? I haven't defined a struct and tried this either- what exactly
am I looking at?
Thanks in advance,
Gene
I understand the use of "ref" and "out" keywords as they apply to method
arguments, and then something this morning stopped me in my tracks. I must
have used FileStream.Read a thousand times and it never dawned on me that I
never have to specify either an "out" or "ref" when I pass the byte array
that I pass to this function- yet it returns the bytes read from the file.
The documentation (msdn) further confused me because they show an "in"
keyword as part of the method definition... how does "in" fit into this?
[C#]
public override int Read(
in byte[] array,
int offset,
int count
);
In C++ arrays and structures are "passed" by pointer- is this what C# is
doing for me? I haven't defined a struct and tried this either- what exactly
am I looking at?
Thanks in advance,
Gene