Exemple #1
0
        public void Remove(T item)
        {
            if (_inner != null)
            {
                int removedIndex = 0;
                T[] newInner     = new T[_inner.Length - 1];
                int newIndex     = 0;

                for (int i = 0; i < _inner.Length; i++)
                {
                    if (_inner[i].Equals(item))
                    {
                        removedIndex = i;
                        continue;
                    }
                    else
                    {
                        newInner[newIndex] = _inner[i];
                        newIndex++;
                    }
                }
                _inner = newInner;
                OnRemoveEvent?.Invoke(item, removedIndex);
            }
            else
            {
                Console.WriteLine("Array is empty");
            }
        }
Exemple #2
0
        public void RemoveAt(int index)
        {
            if (_inner != null && index <= _inner.Length && index >= 0)
            {
                T   removedItem = default(T);
                T[] newInner    = new T[_inner.Length - 1];
                int newIndex    = 0;

                for (int i = 0; i < _inner.Length; i++)
                {
                    if (i == index)
                    {
                        removedItem = _inner[i];
                        continue;
                    }
                    else
                    {
                        newInner[newIndex] = _inner[i];
                        newIndex++;
                    }
                }
                _inner = newInner;
                OnRemoveEvent?.Invoke(removedItem, index);
            }
            else
            {
                Console.WriteLine("Array is empty");
            }
        }
 public void Remove(int id)
 {
     if (_events.ContainsKey(id))
     {
         var ev = _events[id].Copy();
         _events.Remove(id);
         OnRemoveEvent?.Invoke(ev);
     }
 }
Exemple #4
0
        private void _Remove(Queue <T> launchers, List <T> boots)
        {
            while (launchers.Count > 0)
            {
                var launcher = launchers.Dequeue();
                boots.Remove(launcher);
                launcher.Shutdown();

                OnRemoveEvent?.Invoke(launcher);
            }
        }