Z
Zytan
(Sorry, I accidentally posted this to
microsoft.public.dotnet.csharp.general, and I didn't mean to!)
In the following method, a byte array is made, and then passed to
Socket.BeginReceive. The byte array is local. But, presumably,
Socket.BeginReceive creates a reference to it, so the byte array (a
reference) does disappear, but the object the reference 'points' to
(the array data) is referenced by something inside of
Socket.BeginReceive, so all is well when the data receive call back
(DataReceive_CallBack in this case) is called. Right?
public void MyMethod()
{
byte[] bytesArray = new byte[1024];
mySocket.BeginReceive(bytesArray, 0, bytesArray.Length,
SocketFlags.None, DataReceive_CallBack, bytesArray);
}
Zytan
microsoft.public.dotnet.csharp.general, and I didn't mean to!)
In the following method, a byte array is made, and then passed to
Socket.BeginReceive. The byte array is local. But, presumably,
Socket.BeginReceive creates a reference to it, so the byte array (a
reference) does disappear, but the object the reference 'points' to
(the array data) is referenced by something inside of
Socket.BeginReceive, so all is well when the data receive call back
(DataReceive_CallBack in this case) is called. Right?
public void MyMethod()
{
byte[] bytesArray = new byte[1024];
mySocket.BeginReceive(bytesArray, 0, bytesArray.Length,
SocketFlags.None, DataReceive_CallBack, bytesArray);
}
Zytan