Advertisement
Fhernd

MetodoExtensionOrderBy.cs

Sep 29th, 2014
37,011
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Articulo.CSharp.MetodosExtension
  5. {
  6.     public sealed class MetodoExtensionOrderBy
  7.     {
  8.         public static void Main()
  9.         {
  10.             // Declaración e inicialización de un arreglo de enteros:
  11.             int[] enteros = {29, 13, 2, 5, 7, 37, 71};
  12.            
  13.             // Ordenamiento de los elementos:
  14.             var arregloOrdenado = enteros.OrderBy ( num => num);
  15.            
  16.             Console.WriteLine ();
  17.            
  18.             foreach (var num in arregloOrdenado)
  19.             {
  20.                 Console.Write ("{0}\t", num.ToString());
  21.             }
  22.            
  23.             Console.WriteLine (Environment.NewLine);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement