Cannot implicitly convert type 'Microsoft.ProjectOxford.Common.Contract.EmotionScores[]' to 'Microsoft.ProjectOxford.Emotion.Contract.Scores[]'

廉价感情. 提交于 2019-12-12 04:45:07

问题


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()

What can I do ? Thanks


回答1:


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();


来源:https://stackoverflow.com/questions/42039572/cannot-implicitly-convert-type-microsoft-projectoxford-common-contract-emotions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!