Pass method reference instead of delegate
when calling the method:
Application.Current.Dispatcher.Invoke( someDelegate , parameters);
I ne开发者_如何学Pythoned to create the someDelegate pointer. I know how to create the delegate and then pass it with this function. A delegate is just a pointer to a method so it will be nice if I can pass the reference. In other words I don't know if it is possible to do simething like:
Application.Current.Dispatcher.Invoke( someMethod.reference, parameters);
public void someMethod(object o)
{
// ....
}
Or something like:
Application.Current.Dispatcher.Invoke( ()=> {
//method
}, parameters);
I require to use multiple threads therefore it will be nice if I do not have to create that many delegates. It will be nice if I could create them on the fly inside of the method...
Try this:
Application.Current.Dispatcher.Invoke( new Action(()=> {
//method
}), parameters);
精彩评论