本文介绍了无法隐式转换类型'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#

推荐答案

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.



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

10-16 04:51