//C# Sorteren van Arrays - Selection Sort Arrays public class SelectionSortExample { void Main() { int count = 5; int upperbound = (count - 1); int[] numbers = new int[0]; int index; this.numbers(index) = ((((count + index) * 93) % 97) - (count / (index + 1))); Console.Write("unsorted array : "); Console.Write((this.numbers(index) + " ")); Console.WriteLine(); int unsortedCount = count; for (; (unsortedCount > 1); ) { int startIndexUnsortedPart = (count - unsortedCount); int indexSmallestElement = startIndexUnsortedPart; if ((this.numbers(index) < this.numbers(indexSmallestElement))) { indexSmallestElement = index; } int backup = this.numbers(indexSmallestElement); this.numbers(indexSmallestElement) = this.numbers(startIndexUnsortedPart); this.numbers(startIndexUnsortedPart) = backup; unsortedCount = 1; Console.Write("temporary array : "); Console.Write((this.numbers(index) + " ")); Console.WriteLine(); } Console.Write("sorted array : "); Console.Write((this.numbers(index) + " ")); Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.