无法隐式转换类型'system.collections.generic.ienumerable< parse.parseobject>' 'parse.parseobject'。存在显式转换(您是否错过了演员?) [英] Cannot implicitly convert type 'system.collections.generic.ienumerable<parse.parseobject>' to 'parse.parseobject'. An explicit conversion exists (are you missing a cast? )

查看:104
本文介绍了无法隐式转换类型'system.collections.generic.ienumerable< parse.parseobject>' 'parse.parseobject'。存在显式转换(您是否错过了演员?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public async void UserLogin(string username, string password)
       {
           Cursor.Current = Cursors.WaitCursor;
           // show progress hud
           // New Thread : Call lines below

           string ENC = EN.encryptDecrypt(password);
           var query = ParseObject.GetQuery("Admins")
               .WhereEqualTo("userName", username)
               .WhereEqualTo("password", ENC);

          IEnumerable<ParseObject> results = await query.FindAsync();//Here is error

           if(results.Count() > 0)
           {

               user = results; /// here is error msg
           }
           else
           {
               MessageBox.Show("No");
           }

          return user;
       }





我尝试过:



我已经厌倦了尝试了很多人在这里可以帮助我解决谁使用解析SDK与.net c#



What I have tried:

I have tired to trying a lot anyone here can help me about who using parse SDK with .net c#

推荐答案

你声称错误在两个地方,一个是它?此外,您的UserLogin方法无效,因此您无法返回任何内容(您正在尝试返回用户,您只能返回)。接下来我看不出这行怎么回事



You claim the error is in two places, which one is it? Also your UserLogin method is void so you can't return anything (you are trying "return user", you can only just "return"). Next I don't see how this line

IEnumerable<ParseObject> results = await query.FindAsync();





可以给出你发布的错误,除非是导致问题的FindAsync(即在你的查询中)。



无论你是否收到此错误,因为你有一个ParseObject类型的变量,并且你正在分配一些类型为IEnumerable< ParseObject>到那个变量。





can give the error you have posted, unless it's the FindAsync causing the issue (ie something in your query).

Regardless you are getting this error because you have a variable of type ParseObject and you are assigning something pf type IEnumerable<ParseObject> to that variable.

ParseObject po;
IEnumerable<ParseObject> pos = new List<ParseObject>();

po = pos; // error





po是ParseObject,pos是多个ParseObjects的集合,所以你不能将一个ParseObject分配给另一个。解决方案取决于您不了解的业务需求。你可能希望你的收藏中只有一个对象,所以你需要做这样的事情





po is ParseObject and pos is a collection of multiple ParseObjects so you can't assign one to the other. The solution depends on your business needs which we don't know. It could be you are expecting there to only be one object in your collection so you need to do something like this

po = pos.FirstOrDefault();





从发布的内容中很难说。



It's hard to say from what has been posted.


谢谢我有解决了这个问题..
Thanks I have solved this issue..


这篇关于无法隐式转换类型'system.collections.generic.ienumerable&lt; parse.parseobject&gt;' 'parse.parseobject'。存在显式转换(您是否错过了演员?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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