public static void UpdateCacheList <T, U>(SongObjectCache <T> cache, List <U> objectsToCache) where U : SongObject where T : U { var cacheObjectList = cache.EditCache(); cacheObjectList.Clear(); cacheObjectList.AddRange(objectsToCache.OfType <T>()); }
public static void UpdateCacheList <T, U>(SongObjectCache <T> cache, List <U> objectsToCache) where U : SongObject where T : U { var cacheObjectList = cache.EditCache(); cacheObjectList.Clear(); foreach (U objectToCache in objectsToCache) { if (objectToCache.GetType() == typeof(T)) { cacheObjectList.Add(objectToCache as T); } } }