System.Linq.Enumerable+WhereSelectListIterator`2 error -
i getting error : system.linq.enumerable+whereselectlistiterator2[consoleapplication1.person,<>f_ _anonymoustype0
2[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
Post a Comment