I have a foreach loop which is below:
foreach (var rec in lstPRSCRPT)
{
var OrderItemQuery = GV.dbContext.Load(GV.dbContext.GetOrdritemsQuery (rec.PresNo));
OrderItemQuery.Completed += new EventHandler(OrderItemQuery_Completed);
}
In the OrderItemQuery_Completed event, for each call back, I have some calculations to find if certian condition is reached. If so, I dont want to get any further OrderItemQuery_Completed call back. Is there a way I can do that? Is there any way to stop the OrderItemQuery_Completed from being fired.
I unscubscirbed the event and I get an eror as shown in pic:

You can unsubscribe from this event in the handler like this: