「VB.net」New List()で配列をリストに変換する

2020年11月3日

構文
配列をリストに変換する
Public Sub New(collection As IEnumerable(Of T))
サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Module ModuleTest
Sub Main()
Dim cft() As String = {"A001", "B002", "C003", "D004"}
Dim ttLst As New List(Of String)(cft)
For Each k As String In ttLst
Console.WriteLine(k)
Next
End Sub
End Module
Module ModuleTest Sub Main() Dim cft() As String = {"A001", "B002", "C003", "D004"} Dim ttLst As New List(Of String)(cft) For Each k As String In ttLst Console.WriteLine(k) Next End Sub End Module
Module ModuleTest
      Sub Main()
            Dim cft() As String = {"A001", "B002", "C003", "D004"} 
            Dim ttLst As New List(Of String)(cft) 
            For Each k As String In ttLst
                  Console.WriteLine(k) 
            Next

      End Sub
End Module

結果
A001 B002 C003 D004

VB.net

Posted by arkgame