Illegal characters in path in console application

I am going to access a text file from console application and having some data like this-

Auto 2017
Mech 2056
CSE 2016

Error occurred when read file, please see the attached screen.

Thanks in advance.enter image description here

Jon Skeet
people
quotationmark

You're trying to take the text of the file, and then load it as if that were another filename. In other words, you're asking to read a file called "Auto 2017 Mech 2056 CSE 2016" including line breaks. That file doesn't exist, does it?

Get rid of your first File.ReadAllText call, and instead use

string[] lines = File.ReadAllLines(@"c:\Users\admin\...as before...");

people

See more on this question at Stackoverflow