Guest User

Untitled

a guest
May 5th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. public void Linq30()
  2. {
  3.     List<Product> products = GetProductList();
  4.  
  5.     var sortedProducts =
  6.         from prod in products
  7.         orderby prod.ProductName
  8.         select prod;
  9.  
  10.     ObjectDumper.Write(sortedProducts);
  11. }
  12.  
  13. public void Linq32()
  14. {
  15.     double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };
  16.  
  17.     var sortedDoubles =
  18.         from d in doubles
  19.         orderby d descending
  20.         select d;
  21.  
  22.     Console.WriteLine("The doubles from highest to lowest:");
  23.     foreach (var d in sortedDoubles)
  24.     {
  25.         Console.WriteLine(d);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment