public void SetDependency(params ThreadTask[] tasks) { var list = DependsOn.ToList(); list.AddRange(tasks); // clear finished from list for (int i = 0; i < list.Count; i++) { if (list[i].Finished) { list.RemoveAt(i); i--; } } DependsOn = list.ToArray(); }