「VB.net」Valuesプロパティで値の集合を取得する

2020年10月23日

説明
Dictionary<TKey,TValue> 内の値を格納しているコレクションを取得します。
サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Module ModuleTest
Sub Main()
Dim cft As New Dictionary(Of String, String)
cft.Add("Key01", "A001")
cft.Add("Key02", "B002")
cft.Add("Key03", "C003")
For Each k In cft.Values
Console.WriteLine(k)
Next
End Sub
End Module
Module ModuleTest Sub Main() Dim cft As New Dictionary(Of String, String) cft.Add("Key01", "A001") cft.Add("Key02", "B002") cft.Add("Key03", "C003") For Each k In cft.Values Console.WriteLine(k) Next End Sub End Module
Module ModuleTest
    Sub Main()
        Dim cft As New Dictionary(Of String, String)
        cft.Add("Key01", "A001")
        cft.Add("Key02", "B002")
        cft.Add("Key03", "C003")

        For Each k In cft.Values
            Console.WriteLine(k) 
        Next
    End Sub
End Module

結果
A001 B002 C003

VB.net

Posted by arkgame