Mostrar el contenido de un array, girarlo y ordenarlo en C#
C sharp
Publicado el 5 de Julio del 2018 por Info (100 códigos)
1.693 visualizaciones desde el 5 de Julio del 2018
Simple ejemplo del libro para mostrar un array, girarlo y ordenarlo
using System;
public class Tester {
static void Main() {
String[] myArray = {"Who", "is", "John", "Doe"};
PrintMyArray(myArray);
Array.Reverse(myArray);
PrintMyArray(myArray);
String[] myOtherArray = {"We", "Hold", "These", "Truths", "To", "Be", "Self", "Evident"};
PrintMyArray(myOtherArray);
Array.Sort(myOtherArray);
PrintMyArray(myOtherArray);
Console.ReadLine();
}
public static void PrintMyArray(object[] theArray) {
foreach (object obj in theArray)
Console.WriteLine("Value: {0}", obj);
Console.WriteLine();
}
}
Comentarios sobre la versión: 1 (0)
No hay comentarios