Skip to content

Commit 04e01fe

Browse files
committed
Update async/await guidelines based on feedback from paulloz
1 parent e099b2c commit 04e01fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tutorials/scripting/c_sharp/c_sharp_basics.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Using ``async``/``await``
394394

395395
You might face a scenario where you must ``await`` a method call.
396396
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>``.
398398
Consequently, you must call your now ``async`` method using ``await``,
399399
which propagates the problem all the way up the call chain.
400400
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:
416416
417417
public partial class AsyncTestNode : Node
418418
{
419-
int _taskCount = 0;
420-
DateTime start;
419+
private int _taskCount = 0;
420+
private DateTime start;
421421
public override void _Ready()
422422
{
423423
start = DateTime.Now;
@@ -524,8 +524,8 @@ Here is a pattern you can adopt to avoid race conditions:
524524
[Export] public int EntityID { get; set; } = 1;
525525
526526
readonly SomeCustomRepository _db = new();
527-
int _health;
528-
bool _init;
527+
private int _health;
528+
private bool _init;
529529
530530
// We will check IsInvalid after we await async methods
531531
// Otherwise we risk the continuation running in a disposed context

0 commit comments

Comments
 (0)