public object CreateObjectInstance() { ConstructorInfo[] infos = CacheType.GetConstructors(); foreach (ConstructorInfo i in infos) { if (i.GetParameters().Length == 0) { return(i.Invoke(null)); } } throw new Exception("Couldn't create cache object, no constructor without params"); }