public static T GetData <T>(string key, Func <T> func) { T result = default(T); if (CustomerCache.Contains(key)) { result = CustomerCache.Get <T>(key); } else { result = func.Invoke(); CustomerCache.Add(key, result); } return(result); }