public void ArrayFill(object state) { ArraySize arraySize = new ArraySize(); array = new int[arraySize.Size]; lock (locker) { for (int i = 0; i < array.Length; i++) { array[i] = i; } } }
private void StartToFillArray_Click(object sender, RoutedEventArgs e) { Thread[] threads = new Thread[int.Parse(number.Text)]; ArraySize arraySize = new ArraySize { Size = int.Parse(number.Text) }; for (int i = 0; i <= arraySize.Size; i++) { threads[i] = new Thread(ArrayFill); threads[i].Start(); } }