views:

49

answers:

0

I have a DataGridView whose cell values are changed via callback functions that are invoked asynchronously. In one case, I have a callback in the form of an Action<T>. I noticed that if I have a method public void MyMethod(T data) { } and I do:

UpdaterObject.AddCallback(MyMethod);

it works fine, but if I pass in the callback in this way:

UpdaterObject.AddCallback(
            delegate(T data)
            { SomeOtherMethod(data.SomeValue, some_flag); }
    );

it doesn't work. Namely, the cell's value changes (I confirmed this in the debugger), but it doesn't redraw on the screen. Any clue as to why this is the case? For some reason I couldn't reproduce this in a standalone code sample, so it could be some other thing in my code (or my attempt to reproduce it is flawed).