Getting Infinite Loop Issue. Process Terminated due to StackOverflowException?
问题 namespace ConsoleApplication1 { class class1 { protected internal string inf1() { Console.WriteLine("\n......inf1() \n"); return inf1(); } } class class2 :class1 { static void Main(string[] args) { class1 c1 = new class1(); class2 c2 = new class2(); Console.WriteLine(c1.inf1()); Console.WriteLine(c2.inf1()); Console.ReadKey(); } } Getting Infinite Loop Issue. Process Terminated due to StackOverflowException ? How to prevent the code from looping infinitely ? 回答1: In class2 , you are calling