Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. /// <summary>
  2. /// Gets all items that need to be removed for an item (dependencies+item itself)
  3. /// </summary>
  4. public IEnumerable<InstallationItemFactory> GetRemovedFor(InstallationItemFactory i)
  5. {
  6. return current.ToList().Where(p => p.Dependencies.Contains(i)).SelectMany(GetRemovedFor).Concat(new[] { i }).ToList();
  7. }
  8.  
  9. /// <summary>
  10. /// Gets a sequence of the item itself and its dependencies
  11. /// </summary>
  12. public IEnumerable<InstallationItemFactory> GetAddedFor(InstallationItemFactory i)
  13. {
  14. return i.Dependencies.SelectMany(GetAddedFor).Concat(new[] { i }).ToList();
  15. }
  16.  
  17. vs
  18. public IEnumerable<InstallationItemFactory> GetItemAndDependenciesForAdding(InstallationItemFactory i)
  19. {
  20. return i.Dependencies.SelectMany(GetItemAndDependencies).Concat(new[] { i }).ToList();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement