C# Initialize local variable once
问题 I assume my question will be totally stupid but I have to know the answer. Is it possible to initialize a variable just once in this situation? static void Main() { while (true) { MethodA(); MethodB(); } } private static void MethodA() { string dots = string.Empty; // This should be done only once if (dots != "...") dots += "."; else dots = string.Empty; Console.WriteLine(dots + "\t" + "Method A"); System.Threading.Thread.Sleep(500); } private static void MethodB() { string dots = string