private static void Sub1() { var temp = new KeyThread[threads.Length - 1]; for (int i = 0; i < temp.Length; i++) { temp[i] = threads[i]; } threads = temp; }
public static int FindIndex(KeyThread thread) { for (int i = 0; i < threads.Length; i++) { if (threads[i] == thread) { return(i); } } return(-1); }
public static KeyThread Sub(KeyThread thread) { KeyThread ret = null; for (int i = 0; i < threads.Length; i++) { if (threads[i] == thread) { ret = threads[i]; for (int j = i; j < threads.Length - 1; j++) { threads[j] = threads[j + 1]; } } } if (ret != null) { Sub1(); } return(ret); }
public static void Add(Thread a, string key) { if (threads.Length != 0) { for (int i = 0; i < threads.Length; i++) { if (threads[i].Key == key) { throw new ArgumentException("Cant assign 2 threads with the same key!"); } } } var temp = new KeyThread[threads.Length + 1]; for (int i = 0; i < threads.Length; i++) { temp[i] = threads[i]; } temp[temp.Length - 1] = new KeyThread(a, key); threads = temp; }