「VB.NET」 For Each文でListの要素を取得する

2020年10月20日

サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Module ModuleTest
Sub Main()
Dim ct As New List(Of String)
ct.Add("Aa01")
ct.Add("Bb02")
ct.Add("Cc03")
For Each t In ct
Console.WriteLine(t)
Next
End Sub
End Module
Module ModuleTest Sub Main() Dim ct As New List(Of String) ct.Add("Aa01") ct.Add("Bb02") ct.Add("Cc03") For Each t In ct Console.WriteLine(t) Next End Sub End Module
Module ModuleTest
  Sub Main()
    Dim ct As New List(Of String)
    ct.Add("Aa01")
    ct.Add("Bb02")
    ct.Add("Cc03")

    For Each t In ct
      Console.WriteLine(t) 
    Next
  End Sub
End Module

結果
Aa01 Bb02 Cc03

VB.net

Posted by arkgame