Need Help in converting this to VB.NET
public void GetCustomers(Action<IEnumerable<Customer>> onSuccess, Action<Exception> onFail)
{
Manager.Customers.ExecuteAsync(op =>
{
if (op.CompletedSuccessfully)
{
if (onSuccess != null)
onSuccess(op.Results);
}
else
{
if (onFail != null)
{
op.MarkErrorAsHandled();
onFail(op.Error);
}
}
}
);
}
You can do in-line anonymous functions/subs with syntax like:
Sometimes things get really flakey when you use it inline, so when that happens I give the local sub/function a name:
This works well because you can still close over your lexical environment.
This is all from memory – I don’t have VS at home (and I try not to troll SO at work). In particular, I’m not sure I have my closing paren in the right place.
MSDN Reference