Exemplo n.º 1
0
        public static IEnumerable <IResource> GetOrAddResources(this IResourceCache resourceCache, ResourceType resourceType, Func <IEnumerable <IResource> > findResources)
        {
            IEnumerable <IResource> resources;

            if (resourceCache.TryGetResources(resourceType, out resources))
            {
                return(resources);
            }

            resources = findResources();

            if (resources != null)
            {
                resourceCache.StoreResources(resourceType, resources);
            }

            return(resources);
        }