I am creating a small pet cryptography project and am reading text from a text file, modifying it while each line is in an array, and then submitting it back to its text file. The issue is adding the string back to the file, as the text file's current text is simply deleted as of how the program is now. More specifically I want to bring all of the strings in the array into a single string, and this is where I believe the fault is. Here is the code I have written.
static void Main(string[] args)
{
string[] getAllText = File.ReadAllLines("H:\\BetaText.txt");
File.WriteAllText("H:\\BetaText.txt", string.Concat(Lock(getAllText)));
System.Diagnostics.Process.Start("H:\\BetaText.txt");
}
Lock is simply a method in my program that returns an encrypted array of strings. The text file is confirmed to be correctly parsed in and the modification return does indeed return the array as I wanted. The issue continues to be my string.Concat() statement. I do know how to fix this issue with a multi-line statement but I would like to avoid this and learn why the Concat() statement is not working the way I believed it would. I have also used the string.Join method with a "" delimiter. Looking through StackOverflow I have not seen this answered and according to MSDN documentation I do not believe I should be having this issue. Thank you.