我收到以下错误:
An explicit conversion exists. Are you missing a cast?
为什么会这样?
private async void getEmotion_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
try
{
emotionResult = await emotionServiceClient.RecognizeAsync(imageStream.AsStream());
if(emotionResult != null)
{
Scores score = emotionResult[0].Scores;
}
}
catch
{
Output.Text = "Error returning the Emotion";
}
}
答案 0 :(得分:0)
Scores和EmotionScores是名称相同的对象,但不能自动转换。你可以说
EmotionScores scores = emotionResult[0].Scores;
或只是
var scores = emotionResult[0].Scores;