2

I am using linq query in that i need all the values so first i am using linq query and

after that i am taking all values in one List like this

var lst = ProjectContext.My_prj_project.Select(i => new

             {
               Name = list                         

             }).Distinct().FirstOrDefault();                          

 ProjectReportDetailsModels l = new ProjectReportProjectCategoryDetailsModels();

 l.name= lst.Name;    // here i am getting error 

connot implicitly convert 'AnonymousType#1' to 'int'

So please send me any sample, example (or) related link

Thanks in Advance.

4

2 回答 2

1

这可能会帮助你

l.name = lst.Select(x=>x.Name);
于 2013-02-02T09:53:18.860 回答
0

you are getting a list in lst ? then why you are doing FirstOrDefault() ?

l.name = lst.Select(x=>x.Name).FirstOrDefault(); 

will solve the problem but i really cannot comprehend what you are doing ...

于 2013-02-02T07:07:04.010 回答