-
-
Save Roconda/5a0be7c2ea01ab428052 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Blaat { | |
private TaskCompletionSource<Pion> _pionCompletion = new TaskCompletionSource<Pion>(); | |
private void PionKlik(Pion item) | |
{ | |
_pionCompletion.TrySetResult(item); | |
} | |
//spel.cs | |
public async Task<Pion> KiesPion(Func<Pion, bool> mogelijk) | |
{ | |
while (true) | |
{ | |
var pion = await _pionCompletion.Task; | |
_pionCompletion = new TaskCompletionSource<Pion>(); | |
if (mogelijk(pion)) | |
return pion; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment