Parsing and new lines

Hello everyone.

I’m creating a custom class to parse my own level files. To make it, I’m treating the text file string as an array of char, calling string to get a char from the array. Although it’s working mostly fine I’m having problems into detecting new lines, as I can’t tell wether the char I’m reading is a new line character or not. I was trying to do:
if(string_file != System.Environment.NewLine) {
//Some code here
The problem is System.Environment.NewLine is a String, and I can’t seem to get to treat it like a single character. I’ve already tried to check with System.Environment.NewLine[0] as well but I’m not getting the desired results. I might be missing something here, any help would be much appreciated.
Thank you very much

Special characters usually are made up of a reserved character plus an identifier. E.g. a tab is **\ ** and a newline is **
**. So simply checking for a single character will never be sufficient to detect them.

I would suggest using actual string methods, by the way. For example, string splitting at the newline symbol could safe you a lot of time. I doubt it’d have a negative impact over manually parsing text character by character.