|
Слишком много awayt
|
|||
---|---|---|---|
#18+
Разберём одно место из статьи . Конкретно, место автор Redundancy Consider a case where you want to make a decision about whether to buy a stock... Там есть код Код: c# 1. 2. 3. 4. 5. 6. 7. 8.
Вопрос: зачем awayt в последней строке? Ведь и так уже есть ожидание в предпоследней строке. Внизу пишут авторUnlike WhenAll, which returns the unwrapped results of all tasks that completed successfully, WhenAny returns the task that completed. If a task fails, it’s important to know that it failed, and if a task succeeds, it’s important to know which task the return value is associated with. Therefore, you need to access the result of the returned task, or further await it, as this example shows. Но ведь при выполнении метода WhenAny возвращаемая задача уже должна быть завершена, иначе она бы не вернулась - это всё по логике WhenAny. Чего ещё там дальнейшего ожидать ("or further await it")? ... |
|||
:
Нравится:
Не нравится:
|
|||
07.07.2014, 19:55 |
|
|
start [/forum/topic.php?fid=20&fpage=115&tid=1402733]: |
0ms |
get settings: |
12ms |
get forum list: |
13ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
32ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
32ms |
get tp. blocked users: |
2ms |
others: | 14ms |
total: | 129ms |
0 / 0 |