System.Linq.Enumerable+WhereSelectListIterator`2 error -


i getting error : system.linq.enumerable+whereselectlistiterator2[consoleapplication1.person,<>f_ _anonymoustype02[system.string,system.string]]

when try in console application :

public class person {     public int id;     public int idrole;     public string firstname;     public string lastname; }    class program     {         static void main(string[] args)         { list<person> people = new list<person> {         new person() {id = 1, idrole = 1, lastname= "anderson",         firstname = "brad"},         new person() {id = 2, idrole = 2, lastname= "gray",         firstname = "tom"}         };          var query = p in people                     p.id == 1                     select new { p.firstname, p.lastname };        console.write( query);        console.readline();  }} 

you need iterate query

foreach(var q in query)     {       console.write( string.format("{0} {1}",new []{ q.firstname ,q.lastname }));     }     console.readline(); 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -