0
private async void DoSomethibng() {
 var a = await  MAsync();
 Console.WriteLine(a);
}
0

1 ответ 1

2

так как у вас метод async void, то можно его переделать так - будет почти то же самое.

private void DoSomethibng()
{
    MAsync().ContinueWith(t=>Console.WriteLine(t.Result));
}
2
  • А если не void,то как быть?
    – Nikita
    3 июн 2018 в 16:33
  • @Nikita return MAsync().ContinueWith(t=>Console.WriteLine(t.Result)); или задавать второй вопрос с конкретными примерами кода.
    – tym32167
    3 июн 2018 в 16:39

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.