public double CalSquare() { if (cache.ContainsKey(side)) { Console.WriteLine("-- Get value from cache --"); } else { cache.Add(side, real.CalSquare()); } return(cache[side]); }