Q:

Trouble with finding new line character from a string, Reading Text from .txt file

I am reading text from a .TXT file in a String. I am using File.ReadAllText. 
 string Str= File.ReadAllText(@"C:\temp\file.txt", Encoding.Default);

Let's assume the Str contains following string. 
string Str= @"one
    two
    three";

Now the problem is I cannot find the newline characters from Str. 
string[] lines = Str.Split('\n');

foreach(string line in lines)
{
  Console.WriteLine(line.IndexOf('\n'); // prints -1 three times
}

Is there any way I can find newline character in this situation? Please suggest.

A:

.Split will delete the delimiter characters, and the resulting output will not include them.
From MSDN:

Delimiter characters are not included in the elements of the returned
  array.

If you need to find the length of a line, just use the .Length property of the string.
In any case, as mentioned in the comments, use the File.ReadAllLines method to avoid having to split the file contents yourself.

