I have a problem with coverting c# to vb.net on using DispatcherOperationCallback.
I have tried to convert it based on help to convert c# anonymous to vb.net
I'm using VS2010.
I have a c# code like this:
public void Callback(Contract contract)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
(DispatcherOperationCallback)delegate(object arg)
{
Contract obj = (Contract)arg;
txtRequest.Text = HandleArgument(obj);
return null;
}, contract);
}
And After I tried to change to vb.net like this
Public Sub Callback(ByVal contract As Contract) Implements IServiceCallback.Callback
Dispatcher.BeginInvoke(New DispatcherOperationCallback(Sub(arg As Object)
txtRequest.Text = HandleArgument(DirectCast(arg, Contract))
End Sub), DispatcherPriority.Normal, contract)
End Sub
but it did not work. The vs2010 displayed "nested sub does not have a signature that is compatible with delegate "Delegate Function DispatcherOperationCallback(arg As Object) As Object"
Thank you for your help.