Query an array of object by its property value : Object Query : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Object Query »

 

Query an array of object by its property value








    
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
public class Book {
    public String Title { get; set; }

    public override String ToString() {
        return Title;
    }
}

class Program {
    static void Main(string[] args) {
        Book[] books = {
      new Book { Title="A" },
      new Book { Title="F" },
      new Book { Title="E" } };

        var titles =
          books
            .Where(book => book.Title.Contains("A"))
            .Select(book => book.Title);

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Object Query