Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created July 15, 2020 23:38
Show Gist options
  • Save dcomartin/112ef5045826559881a498cf21915dab to your computer and use it in GitHub Desktop.
Save dcomartin/112ef5045826559881a498cf21915dab to your computer and use it in GitHub Desktop.
public class ClassA
{
private readonly ClassB _classB;
private readonly ClassC _classC;
public ClassA(ClassB classB, ClassC classC)
{
_classB = classB;
_classC = classC;
}
public async Task<int> DoWork()
{
var taskC = _classC.NotThreadSafe("test");
var taskB = _classB.DoWork();
await Task.WhenAll(taskB, taskC);
return await taskC;
}
}
public class ClassB
{
private readonly ClassC _classC;
public ClassB(ClassC classC)
{
_classC = classC;
}
public async Task<int> DoWork()
{
return await _classC.NotThreadSafe("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment