Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created July 15, 2020 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/8bed09be0c7163cbea5dfd9835b9e3a6 to your computer and use it in GitHub Desktop.
Save dcomartin/8bed09be0c7163cbea5dfd9835b9e3a6 to your computer and use it in GitHub Desktop.
public class ClassC
{
private string? _state;
public async Task<int> NotThreadSafe(string state)
{
_state = state;
// Delay this Task so we can end up having ClassB change the state before we return the length
if (state.Length > 0)
{
await Task.Delay(10);
}
return _state.Length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment