There was such a problem: the code runs, but does not read the text file, much less create a new one. Tell me how you can change ...
public static void Main() { string path = @"NewFile.txt"; if (!File.Exists(path)) { string[] createText = { "Hello", "And", "Welcome" }; File.WriteAllLines(path, createText); } string[] readText = File.ReadAllLines(path); for (int i = 0; i < readText.Length; i++) { StringBuilder builder = new StringBuilder(); foreach (char ch in readText[i]) { if (Char.IsLetter(ch)) { if (Char.IsUpper(ch)) builder.Append(Char.ToLower(ch)); else builder.Append(Char.ToUpper(ch)); } else { builder.Append(ch); } } readText[i] = builder.ToString(); } File.WriteAllLines(path, readText); Console.ReadLine (); }
;instring[] readText = File.ReadAllLines(path)and}at the end - RusArt