public EntityCollection <TEntityId, TComponentKind> GetEntityCollection(IEnumerable <TComponentKind> all, IEnumerable <TComponentKind> any, IEnumerable <TComponentKind> none, IComponentReferenceAccess <TEntityId, TComponentKind> componentReferenceAccess) { var allAsICollection = EnumerableHelper.AsICollection(all); var anyAsICollection = EnumerableHelper.AsICollection(any); var noneAsICollection = EnumerableHelper.AsICollection(none); var queryId = _queryManager.CreateQuery(allAsICollection, anyAsICollection, noneAsICollection); return(_entityIdsByQueryId.TryGetValue(queryId, out var entityCollection) ? entityCollection : CreateEntityCollection(EnumerableHelper.Concat(allAsICollection, anyAsICollection, noneAsICollection), queryId, componentReferenceAccess)); }