diff --git a/OpenSim/Region/Environment/Scenes/EntityManager.cs b/OpenSim/Region/Environment/Scenes/EntityManager.cs index f515cba039..43bf090a80 100644 --- a/OpenSim/Region/Environment/Scenes/EntityManager.cs +++ b/OpenSim/Region/Environment/Scenes/EntityManager.cs @@ -1,10 +1,11 @@ using System; +using System.Collections; using System.Collections.Generic; using OpenMetaverse; namespace OpenSim.Region.Environment.Scenes { - public class EntityManager + public class EntityManager : IEnumerable { private readonly Dictionary m_eb_uuid = new Dictionary(); private readonly Dictionary m_eb_localID = new Dictionary(); @@ -106,7 +107,6 @@ namespace OpenSim.Region.Environment.Scenes return tmp; } - [Obsolete("Please used indexed access to this instead. Indexes can be accessed via EntitiesManager[index]. LocalID and UUID are supported.")] public List GetEntities() { lock (m_lock) @@ -144,5 +144,19 @@ namespace OpenSim.Region.Environment.Scenes InsertOrReplace(value); } } + + /// + /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. + /// + /// + public IEnumerator GetEnumerator() + { + return GetEntities().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } }