Created
July 15, 2020 23:38
-
-
Save dcomartin/112ef5045826559881a498cf21915dab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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