private int Add(EntityInBuffer entityInBuffer) { if (this.capacity <= this.count) { // TODO: ... } int index = this.count++; this.entitiesInBuffer[index] = entityInBuffer; Array.Sort <EntityInBuffer>(this.entitiesInBuffer, 0, this.count); return(index); }
private int GetIndexOfEntityInBuffer(Entity entity) { var lookup = new EntityInBuffer(entity); return(Array.BinarySearch <EntityInBuffer>(this.entitiesInBuffer, 0, this.count, lookup)); }