Chad Z. Hower aka Kudzu said:
Daniel O'Connell said:
Which sample was it? Something is very odd about that...
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpconASynchronousFileIO.asp
public static Object NumImagesMutex = new Object[0];
This is really strange, unless there is(was) a bug in object itself that I'm
not aware of this is a strange construct. An array of type object, even with
no members probably takes up more memory space than an empty object. I
really wonder what the point was...
This line also looks suspicious:
fs.BeginRead(state.pixels, 0, numPixels, readImageCallback,
state);
Is it my imagination or is the call back not being referenced correctly? Such
has never compiled in my code...
The callback is ok, although the ease of reading of this code sucks(for
non-colored code I like a little space inbetween comments and code), there
is a variable near the top of the method defined as:
AsyncCallback readImageCallback = new
AsyncCallback(ReadInImageCallback);
which is perfectly ok, a delegate is just an object afterall.