How to: Add a string to a string array using File.ReadAllLines
I think the question is clear: I want to add a new string to an existing string array, which gets ist content from a File.ReadAllLines
.
public void CreateNewFolder()
{
string[] lines = File.ReadAllLines(stringFile, Encoding.UTF8);
lines[lines.Length + 1] = "Test";
File.WriteAllLines(stringFile, lines, Encoding.UTF8);
}
The index of the array is "too small", but I do not know why.