public static void ExtractCommonCacheData(IBuildCache cache, IEnumerable <ObjectIdentifier> includedObjects, IEnumerable <ObjectIdentifier> referencedObjects, HashSet <Type> uniqueTypes, List <KeyValuePair <ObjectIdentifier, Type[]> > objectTypes, HashSet <CacheEntry> dependencies) { if (includedObjects != null) { foreach (var objectId in includedObjects) { var types = BuildCacheUtility.GetTypeForObject(objectId); objectTypes.Add(new KeyValuePair <ObjectIdentifier, Type[]>(objectId, types)); uniqueTypes.UnionWith(types); } } if (referencedObjects != null) { foreach (var objectId in referencedObjects) { var types = BuildCacheUtility.GetTypeForObject(objectId); objectTypes.Add(new KeyValuePair <ObjectIdentifier, Type[]>(objectId, types)); uniqueTypes.UnionWith(types); dependencies.Add(cache.GetCacheEntry(objectId)); } } dependencies.UnionWith(uniqueTypes.Select(cache.GetCacheEntry)); }