Is there any way to insert an empty line in a string type variable.

string textFile = "abc";

textFile = textFile + string.Empty;
textFile = textFile + "def";

This is what I'm trying. But the string.Empty has no effect.

This also neither works textFile = textFile + "\n";

Any suggestions?

string.Empty is the empty string, not an empty line. "\n" is a string that contains a newline character. If you want an empty line, you need two newline characters.

So I need to do this

textFile = textFile + "\n\n"; ?

string.Empty is the empty string, not an empty line. "\n" is a string that contains a newline character. If you want an empty line, you need two newline characters.

The first newline moves you to the beginning of a new line.
The second newline moves you to the beginning of yet another new line. That way you get an empty line between two "string" lines. If you know how a typewriter works you will get the idea.

This question has already been answered. Start a new discussion instead.