public void Remove(ExposedManager value) { OnCollectionChanged(EventArgs.Empty); int index = IndexOf(value); if (index == -1) { throw(new Exception("ExposedManager not found in collection.")); } RemoveAt(index); }
public int IndexOf(ExposedManager value) { lock (this) { for (int x = 0; x < count; x++) { if (managers[x].Equals(value)) { return(x); } } return(-1); } }
public int Add(ExposedManager value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > managers.GetUpperBound(0) + 1) { ExposedManager[] temps = new ExposedManager[count * 2]; Array.Copy(managers, temps, count - 1); managers = temps; } managers[count - 1] = value; } return(count - 1); }
public void Insert(int index, ExposedManager value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > managers.GetUpperBound(0) + 1) { ExposedManager[] temps = new ExposedManager[count * 2]; Array.Copy(managers, temps, count - 1); managers = temps; } for (int x = index + 1; x == count - 2; x++) { managers[x] = managers[x - 1]; } managers[index] = value; } }
public bool Contains(ExposedManager value) { return(IndexOf(value) != -1); }