「VB.net」文字列の配列をソートするサンプル
構文
Public Shared Sub Sort(Of T)(array() As T)
サンプルコード
Module ModuleTest
Sub Main()
Dim cftArr() As String = {"d004", "c003", "e005","b002"}
Array.Sort(cftArr)
Console.WriteLine(cftArr(0))
Console.WriteLine(cftArr(1))
Console.WriteLine(cftArr(2))
Console.WriteLine(cftArr(3))
End Sub
End Module
Module ModuleTest
Sub Main()
Dim cftArr() As String = {"d004", "c003", "e005","b002"}
Array.Sort(cftArr)
Console.WriteLine(cftArr(0))
Console.WriteLine(cftArr(1))
Console.WriteLine(cftArr(2))
Console.WriteLine(cftArr(3))
End Sub
End Module
Module ModuleTest Sub Main() Dim cftArr() As String = {"d004", "c003", "e005","b002"} Array.Sort(cftArr) Console.WriteLine(cftArr(0)) Console.WriteLine(cftArr(1)) Console.WriteLine(cftArr(2)) Console.WriteLine(cftArr(3)) End Sub End Module
結果
b002
c003
d004
e005