Where is there documentation on the treatment of arguments to BeginInvoke?
If I have a delegate (which wraps my handler function) that accepts an object as a parameter, does that object get copied or referenced by the asynchronously-called handler function?
delegate void MyDelegate(SomeObject obj);
// later on:
// invoke the delegate async'ly:
new MyDelegate(StaticClass.HandlerFunc).BeginInvoke(objInstance, null, null);
// alter the object:
objInstance.SomeProperty = newValue;
// function:
public static void HandlerFunc(SomeObject obj) {
// is it a possible race condition to read SomeProperty:
if(obj.SomeProperty == oldValue) {
// will possibly never enter?
}
// ... etc.
}