InjectModule.InjectInstanceMap.cs 682 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. namespace IFramework.Inject
  4. {
  5. public partial class InjectModule
  6. {
  7. private class InjectInstanceMap : InjectMap<object>
  8. {
  9. public IEnumerable<object> GetInstances(Type type)
  10. {
  11. List<int> list;
  12. if (map.TryGetValue(type, out list))
  13. {
  14. for (int i = list.Count - 1; i >= 0; i--)
  15. {
  16. int index = list[i];
  17. var value = containers[index];
  18. yield return value.value;
  19. }
  20. }
  21. }
  22. }
  23. }
  24. }