Read the last line Txt

I have a txt file, and I want to know what the text of the last line is.

The last line of the txt can have information or is blank.

I am using VReadPath.Split (Environment.NewLine.ToCharArray) .Count; to count the total number of lines. In the assign is the Variable1

Also I use Variable2.Split (Environment.NewLine.TocharArray) (Variable1 - 1)

To be able to read the information on the last line. With this code it works for me, however in very large files (greater than 200 MB), it responds with the following error. RemoteException wrapping System.Exception: Job stopped with an unexpected exit code: 0xE0434352.

Files smaller than 200 MB, it works perfect. Heavier files, the error message appears.

How could you solve this error, or optimize the code used.

Hi @Julian_Yamid_Torres_Torre


lastLine = File.ReadAllLines( yourFilePath ).Last()