using System.Collections.Generic;
public string ISBN { get; set; }
public string Title { get; set; }
public int Price { get; set; }
public static List<Book> Books = new List<Book>{
new Book{ ISBN="N24B3234910", Title="Linq in .NET", Price=1000 },
new Book{ ISBN="N24B3234910", Title="AOP in .NET", Price=2000 },
new Book{ ISBN="N24B3234910", Title="Constructs in .NET", Price=3000 },
new Book{ ISBN="N24B3234910", Title="Web Programming in .NET", Price=4000 },
new Book{ ISBN="N24B3234910", Title="Embedded Programming in .NET", Price=5000 }
public static void Main()
var queryBook = SampleData.Books.Where(book=>book.Title=="Linq in .NET").OrderBy(book=>book.Title).Select(book=>new {book.Title,book.Price});
Console.WriteLine("{0} - NRs {1}/-",queryBook.FirstOrDefault()?.Title,queryBook.FirstOrDefault()?.Price);
var queryBook2 = from book in SampleData.Books where book.Title=="Linq in .NET" orderby book.Title select new {book.Title,book.Price};
Console.WriteLine("{0} - NRs {1}/-",queryBook2.FirstOrDefault()?.Title,queryBook2.FirstOrDefault()?.Price);