Hi,
You can't do that. Method can't return anonymous type.
Create class with author, publisher and price properties and then return them from your method.
That way your method will return known type and all will work.
Define class:
public class YourClass
{
public string Publisher {get; set;}
public string Author {get; set;}
public int Price {get; set;}
}
And change method to select and return your defined type:
public static class Class1
{
public static IQueryable<yourclass> Testlinq()
{
select new YourClass
{
Publisher = tit.publisher,
Price = tit.price,
Author = autit.author
};
foreach (var item in query)
{
var tmp = item.author + " " + item.price + " " + item.publisher;
}
return query;
}
}
Maybe there are some syntax errors but you will get the point...