The injectable service is actually working like this:
public event Action<TValue1, TValue2, TValue3> OnAddChange;
public void AddReport(TValue1 var1, TValue2 var2, TValue3 var3)
{
NotifyAddChanged(var1, var2, var3);
}
private void NotifyAddChanged(TValue1 var1, TValue2 var2, TValue3 var3)
{
OnAddChange?.Invoke(var1, var2, var3);
}
And the consumer goes like this:
protected override void OnInitialized()
{
MyService.OnAddChange+= addToList;
}
public void Dispose()
{
MyService.OnAddChange -= addToList;
}
private void addToList(TValue1 variable1, TValue2 variable2, TValue3 variable3)
{
}
But I came to a point where my event must be asynchronous.
I tried different approach like public Task event Action<TValue1, TValue2, TValue3> OnAddChange;
, but it isn't working.
So, how can I make it asynchronous?