How to split on newline in C#

How to split a string with newline in C#. Split is only accepting char but you can use the overload function. There are two options with string array

string[] lines = theText.Split(
    new string[] { Environment.NewLine },
    StringSplitOptions.None
);

You can also do the extended version of using the different types of line breaks.

string[] lines = theText.Split(
    new string[] { "\r\n", "\r", "\n" },
    StringSplitOptions.None
);