Como: Classificar uma matriz em Visual Basic
This example declares an array of String objects named zooAnimals, populates it, and then sorts it alphabetically.
Exemplo
This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Visual Basic Language. For more information, see Como: Inserir trechos de código de IntelliSense.
Private Sub sortAnimals()
Dim zooAnimals(2) As String
zooAnimals(0) = "lion"
zooAnimals(1) = "turtle"
zooAnimals(2) = "ostrich"
Array.Sort(zooAnimals)
End Sub
Compilando o código
This example requires:
- Access to Mscorlib.dll and the System namespace.
Programação robusta
The following conditions may cause an exception:
Array is empty (ArgumentNullException class)
Array is multidimensional (RankException class)
One or more elements of the array do not implement the IComparable interface (InvalidOperationException class)
Consulte também
Tarefas
Como: Reverter o conteúdo de uma matriz no Visual Basic
Solucionando problemas de matrizes (Visual Basic)