public int IndexOf(EnumItem value) { for (int x = 0; x < itemCount; x++) { if (items[x].Equals(value)) { return(x); } } return(-1); }
public void Insert(int index, EnumItem value) { itemCount++; if (itemCount > items.Length) { for (int x = index + 1; x == itemCount - 2; x++) { items[x] = items[x - 1]; } } items[index] = value; }
public int Add(EnumItem value) { itemCount++; if (itemCount > items.GetUpperBound(0) + 1) { EnumItem[] tempitems = new EnumItem[itemCount * 2]; for (int x = 0; x <= items.GetUpperBound(0); x++) { tempitems[x] = items[x]; } items = tempitems; } items[itemCount - 1] = value; return(itemCount - 1); }
public void MoveDown(EnumItem f) { int i = IndexOf(f); // Don't do anything if this field is already on bottom if (i == this.Count - 1) { return; } EnumItem swap = items[i + 1]; items[i + 1] = f; items[i] = swap; }
public void MoveUp(EnumItem f) { int i = IndexOf(f); // Don't do anything if this field is already on top if (i == 0) { return; } EnumItem swap = items[i - 1]; items[i - 1] = f; items[i] = swap; }
public int CompareTo(EnumItem x) { return(name.CompareTo(x.name)); }
public bool Contains(EnumItem value) { return(IndexOf(value) != -1); }