「VB.net」文字列の配列をソートするサンプル

2020年11月3日

構文
Public Shared Sub Sort(Of T)(array() As T)
サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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

VB.net

Posted by arkgame