c# - Implicitly Convert Type -


i doing in wpf , using entity-framework .

this query code in crud class file :

 public class questionhint     {         public int? questionno { get; set; } //change type accordingly          public int? activityid { get; set; } //change type accordingly          public int? taskid { get; set; } //change type accordingly          public string answer { get; set; }   //change type accordingly          public string questioncontent { get; set; }   //change type accordingly          public string joined { get; set; }   //change type accordingly          public string joinoption { get; set; }   //change type accordingly       }          public ilist<questionhint> getlistkeys(int listtask, int listactivity)     {         ilist<questionhint> lstrecords = context.questionhints.groupby(x => new { x.questionno, x.activityid, x.taskid }).tolist().select(g => new questionhint()         {             questionno = g.key.questionno,             activityid = g.key.activityid,             taskid = g.key.taskid,             joined = string.join(" ",                 g.orderby(q => q.questionhintid)                  .select(i => i.questioncontent + "[" + i.answer + "]")),             joinoption = string.join(" ",                    g.orderby(q => q.questionhintid)                     .select(a => "[" + a.option1 + "," + a.option2 + "]"))           }).where(x => x.taskid == listtask && x.activityid == listactivity)             //.take(50)     .tolist();          return lstrecords;     } 

i call in code behind :

 private dao.daoquestionhint qh = new dao.daoquestionhint();      public mainwindow2()     {         initializecomponent();         populatequestion(1, 5);     }      private void populatequestion(int activityid, int taskid)     {           ilist<questionhint> lstquestionhints = qh.getlistkeys(taskid, activityid); // error          //codes here...         } 

i getting error in code behind of xaml.cs :

cannot implicitly convert type 'system.collections.generic.ilist' 'system.collections.generic.ilist'. explicit conversion exists (are missing cast?)

istellar name of project. daoquestionhint name of crud class file.

there no error in crud class file , use same query retrieve records in other project , works , don't know why don't work in here.

you're using different capitalization generic argument in each example - ilist<questionhint> in getlistkeys() , ilist<model.questionhint> in populatequestion(). i'd guess these refer named different types.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -