' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.IO
Imports System.Collections.Generic

Namespace E
    Public Class Data
        Public Property V1() As String
            Get
                Return m_V1
            End Get
            Set
                m_V1 = Value
            End Set
        End Property
        Private m_V1 As String
        Public Property V2() As Decimal
            Get
                Return m_V2
            End Get
            Set
                m_V2 = Value
            End Set
        End Property
        Private m_V2 As Decimal
    End Class
    Public Class Program
        Public Shared Function Find(fnm As String, v0 As String) As List(Of Data)
            Dim res As New List(Of Data)()
            Using sr As New StreamReader(fnm)
                Dim line As String
                line = sr.ReadLine()
                While line IsNot Nothing
                    Dim flds As String() = line.Split(";"C)
                    If flds.Length = 3 AndAlso flds(0) = v0 Then
                        res.Add(New Data() With { .V1 = flds(1), .V2 = Decimal.Parse(flds(2)) })
                    End If
                    line = sr.ReadLine()
                End While
            End Using
            Return res
        End Function
        Public Shared Sub Main(args As String())
            For Each d As Data In Find("C:\test.csv", "20")
                Console.WriteLine(d.V1 & " " & d.V2)
            Next
        End Sub
    End Class
End Namespace
