File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
tutorials/scripting/c_sharp Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -394,7 +394,7 @@ Using ``async``/``await``
394
394
395
395
You might face a scenario where you must ``await `` a method call.
396
396
You will notice that when you use ``await ``, you are required to mark the method you use it in as ``async ``,
397
- and change the return type to ``Task `` or ``Task<T> ``.
397
+ and change the return type to an awaitable type, such as ``Task `` or ``Task<T> ``.
398
398
Consequently, you must call your now ``async `` method using ``await ``,
399
399
which propagates the problem all the way up the call chain.
400
400
This is why many people compare ``async ``/``await `` to a "zombie virus",
@@ -416,8 +416,8 @@ To compare these options, we will work with the following script:
416
416
417
417
public partial class AsyncTestNode : Node
418
418
{
419
- int _taskCount = 0 ;
420
- DateTime start ;
419
+ private int _taskCount = 0 ;
420
+ private DateTime start ;
421
421
public override void _Ready ()
422
422
{
423
423
start = DateTime .Now ;
@@ -524,8 +524,8 @@ Here is a pattern you can adopt to avoid race conditions:
524
524
[Export ] public int EntityID { get ; set ; } = 1 ;
525
525
526
526
readonly SomeCustomRepository _db = new ();
527
- int _health ;
528
- bool _init ;
527
+ private int _health ;
528
+ private bool _init ;
529
529
530
530
// We will check IsInvalid after we await async methods
531
531
// Otherwise we risk the continuation running in a disposed context
You can’t perform that action at this time.
0 commit comments