无法将类型"Microsoft.ProjectOxford.Common.Contract.EmotionScores []"隐式转换为"Microsoft.ProjectOxford.Emotion.Contract.Scores []" [英] Cannot implicitly convert type 'Microsoft.ProjectOxford.Common.Contract.EmotionScores[]' to 'Microsoft.ProjectOxford.Emotion.Contract.Scores[]'

查看:87
本文介绍了无法将类型"Microsoft.ProjectOxford.Common.Contract.EmotionScores []"隐式转换为"Microsoft.ProjectOxford.Emotion.Contract.Scores []"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行示例应用程序.它工作了一次,然后一次,我在MainWindow.xaml.cs

I am trying to run the sample app. It worked once and after that one time I keep getting the error in the title in the following code line in MainWindow.xaml.cs

EmotionScores = emotions.Select(e => e.Scores).ToArray()

我该怎么办?谢谢

推荐答案

您收到的错误消息非常不言自明.您尝试将对Scores数组的引用分配给可以保存对EmotionScores数组的引用的变量.之所以无法做到这一点,是因为这些类型之间似乎没有任何隐式转换.

The error message you get is pretty self-explanatory. You try to assign a reference to an array of Scores to a variable that can holds a reference to an array of EmotionScores. This cannot be done, because as it seems there isn't any implicit conversion between these types.

如果只想获取分数并将其保存在某个地方,则可以将其存储在另一个变量中:

If just want to get and save somewhere the scores, you could just store them in another variable:

var scores = emotions.Select(e => e.Scores).ToArray();

这篇关于无法将类型"Microsoft.ProjectOxford.Common.Contract.EmotionScores []"隐式转换为"Microsoft.ProjectOxford.Emotion.Contract.Scores []"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆