示例#1
0
 public int IndexOf(EnumItem value)
 {
     for (int x = 0; x < itemCount; x++)
     {
         if (items[x].Equals(value))
         {
             return(x);
         }
     }
     return(-1);
 }
示例#2
0
 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;
 }
示例#3
0
 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);
 }
示例#4
0
        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;
        }
示例#5
0
        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;
        }
示例#6
0
 public int CompareTo(EnumItem x)
 {
     return(name.CompareTo(x.name));
 }
示例#7
0
 public bool Contains(EnumItem value)
 {
     return(IndexOf(value) != -1);
 }