Почему метод AsyncEventHandler может возвращать void или Task?C#

Место общения программистов C#
Ответить
Anonymous
 Почему метод AsyncEventHandler может возвращать void или Task?

Сообщение Anonymous »


Blazor has a callback AsyncEventHandler struct that is used for declaring events in a component. Here’s a useful discussion about how to get called by the event.

I’ve found that the method assigned to an AsyncEventHandler can return void or Task. How can it return void when it’s declared to return Task. Does the system view a return of void being a Task that has completed?

And I’m talking here of a method that returns void, not “async void”. So a truly synchronous method.


Источник: https://stackoverflow.com/questions/780 ... id-or-task
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»