private static IEnumerable<ITask> GetDependantTasks(IEnumerable<ITask> tasks, ITask task) { var dependsUpon = task.DependsUpon(); if (dependsUpon == null) { return new List<ITask>(); } var dependsUponList = dependsUpon as List<Type> ?? dependsUpon.ToList(); return tasks.Where(t => dependsUponList.Contains(t.GetType())); }