示例#1
0
        public Form1()
        {
            InitializeComponent();
            MyArray       tab           = new MyArray();
            EventListener eventListener = new EventListener(tab);

            for (int i = 0; i < 100; i++)
            {
                ParameterizedThreadStart parameterizedThreadStart = new ParameterizedThreadStart(tab.Add);
                Thread myThread = new Thread(parameterizedThreadStart);
                myThread.Start(myThread.ManagedThreadId);
            }
            for (int i = 0; i < 100; i++)
            {
                ParameterizedThreadStart parameterizedThreadStart2 = new ParameterizedThreadStart(tab.AddNotBlocking);
                Thread myThread2 = new Thread(parameterizedThreadStart2);
                myThread2.Start(myThread2.ManagedThreadId);
            }
            tab.save();
        }
示例#2
0
 public EventListener(MyArray myArray)
 {
     this.myArray         = myArray;
     myArray.sizeChanged += new MyEventHandler(TableChanged);
 }
示例#3
0
 public void Detach()
 {
     myArray.sizeChanged -= new MyEventHandler(TableChanged);
     myArray              = null;
 }