Вот способ прочитать только последнюю строку, не просматривая весь файл.
Он переходит в конец файла и начинает читать в обратном направлении, пока не достигнет другого символа LF, который указывает конец второй строки до последней, а затем просто прочитает эту строку.
В большом файле с миллионами строк это снижает стоимость чтения нескольких байтов.
Вы можете раскомментировать код Dts.Events.FireInformation, что происходит в вашем окне вывода.
Dim i As Integer
Dim CurrentByte As Integer
Dim Trailer As String
i = 1
Using reader As StreamReader = New StreamReader("c:\temp\SourceFile.txt")
Do While CurrentByte <> 10 'while we are not finding the next LF character
reader.BaseStream.Seek((-1 * i) - 2, SeekOrigin.End) 'seeking backwards from the last position in the file minus the last CRLF
'Dts.Events.FireInformation(0, "Now at position", reader.BaseStream.Position().ToString, "", 0, False)
CurrentByte = reader.BaseStream.ReadByte 'read the next byte, this will advance pointer position
'Dts.Events.FireInformation(0, "Current ASCII Code", CurrentByte & " Character:" & Chr(CurrentByte), "", 0, False)
i = i + 1 'go to the next character
Loop
Trailer = reader.ReadLine 'we exited on the LF character, so we are at the beginning of trailer line
Dts.Events.FireInformation(0, " Trailer:", Trailer, "", 0, False)
End Using