I am having a singleton class in my code.
In my main function, I created an object of that class.
Then, I tried to create the clone for that object.
And, it gave me "StackOverflowException".
My code looks like:
namespace SingletonApplication
{
    class A : ICloneable
    {
        private static readonly A A1 = new A();
        public A A2 { get { return A1; } }
        public object Clone()
        {
            var obj = ((ICloneable)A1).Clone();
            return obj;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            A obj1 = new A();
            A obj2 = (A)(obj1.Clone());
            Console.WriteLine(object.ReferenceEquals(obj1.A2, obj2.A2));
            Console.ReadKey();
        }
    }
}

 
     
     
     
    