1

我SpeechSynthesizer收到一個錯誤,它說:SpeechSynthesizer錯誤8

Error: 'await' requires that the type 'Windows.Foundation.IAsynAction' have a suitable GetAwaiter method. Are you missing directive for 'System'?

我使用純文本,我的代碼是這樣

await synth.SpeakTextAsync(titleTextBox.Text); 

回答

1

添加async關鍵字到方法頭。

private async void MethodName() 
    { 
     var synth = new SpeechSynthesizer(); 
     await synth.SpeakTextAsync(titleTextBox.Text); 
    }