I am trying to write c# code, in which I am supposed to read a paragraph in a txt. file, and then split all the sentences. Then, I am supposed to print all the sentences into a new txt. file, and they still have to have all their periods, and have to be perfectly aligned. For example, if the paragraph is: **This is the first sentence. This is the second sentence. And this is the third sentence.**, then the output (in a new txt. file) should be:

This is the first sentence. 

This is the second sentence.

And this is the third sentence.

I wrote some code, and it all seems to be working, except that there is an empty line at the end that I don't think should be there, since I checked for empty lines. Here is my code: 

```
  using System;
  using static System.Console;
  using System.IO;

 class Test
{
    public static void Main()
    {

        // Open the text file using a stream reader.
        using (StreamReader sr = new StreamReader("a.txt"))
        {

            // Read the stream to a string, and write the string to the console.
        String line = sr.ReadToEnd();

        string[] sentences = line.Split('.');

        using (StreamWriter newFile = new StreamWriter("b.txt"))

            for (int i = 0; i < sentences.Length; i++)
            {
                if (sentences[i].Length != 0)
                {
                    string outString = sentences[i].Trim() + ".";
                    newFile.WriteLine(outString);
                    WriteLine(outString);

                }
            }

        }

    }
}

```

The output that I get here is: 

This is the first sentence.

This is the second sentence.

And this is the third sentence.

[empty line]

I don't know why there is a space at the end of my txt. file. Any help would be greatly appreciated!!!

Thanks so much.