日期:2014-05-20 浏览次数:21095 次
void Main()
{
List<Book> books = new List<Book>() {
new Book { Title="LINQ in Action" },
new Book { Title="LINQ for Fun" },
new Book { Title="Extreme LINQ" } };
var titles =
books
.Where(book => book.Title.Contains("Action"))
.Select(book => book.Title);
Console.WriteLine(titles);
}
public class Book
{
public string Title { get; set; }
}
// Define other methods and classes here
------解决方案--------------------
http://www.linqpad.net/