using System;
using System.Linq;
namespace Articulo.CSharp.MetodosExtension
{
public sealed class MetodoExtensionOrderBy
{
public static void Main()
{
// Declaración e inicialización de un arreglo de enteros:
int[] enteros = {29, 13, 2, 5, 7, 37, 71};
// Ordenamiento de los elementos:
var arregloOrdenado = enteros.OrderBy ( num => num);
Console.WriteLine ();
foreach (var num in arregloOrdenado)
{
Console.Write ("{0}\t", num.ToString());
}
Console.WriteLine (Environment.NewLine);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKCm5hbWVzcGFjZSBBcnRpY3Vsby5DU2hhcnAuTWV0b2Rvc0V4dGVuc2lvbgp7CiAgICBwdWJsaWMgc2VhbGVkIGNsYXNzIE1ldG9kb0V4dGVuc2lvbk9yZGVyQnkKICAgIHsKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCiAgICAgICAgewogICAgICAgICAgICAvLyBEZWNsYXJhY2nDs24gZSBpbmljaWFsaXphY2nDs24gZGUgdW4gYXJyZWdsbyBkZSBlbnRlcm9zOgogICAgICAgICAgICBpbnRbXSBlbnRlcm9zID0gezI5LCAxMywgMiwgNSwgNywgMzcsIDcxfTsKICAgICAgICAgICAgCiAgICAgICAgICAgIC8vIE9yZGVuYW1pZW50byBkZSBsb3MgZWxlbWVudG9zOgogICAgICAgICAgICB2YXIgYXJyZWdsb09yZGVuYWRvID0gZW50ZXJvcy5PcmRlckJ5ICggbnVtID0+IG51bSk7CiAgICAgICAgICAgIAogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSAoKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIGZvcmVhY2ggKHZhciBudW0gaW4gYXJyZWdsb09yZGVuYWRvKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlICgiezB9XHQiLCBudW0uVG9TdHJpbmcoKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgCiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lIChFbnZpcm9ubWVudC5OZXdMaW5lKTsKICAgICAgICB9CiAgICB9Cn0=