System.Collections.Hashtable.Clear C# (CSharp) Method

Clear() public method

public Clear ( ) : void
return void
        public virtual void Clear()
        {
            Debug.Assert(!_isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously!  Don't do that - use Hashtable.Synchronized.");

            if (_count == 0 && _occupancy == 0)
                return;

            _isWriterInProgress = true;
            for (int i = 0; i < _buckets.Length; i++)
            {
                _buckets[i].hash_coll = 0;
                _buckets[i].key = null;
                _buckets[i].val = null;
            }

            _count = 0;
            _occupancy = 0;
            UpdateVersion();
            _isWriterInProgress = false;
        }

Usage Example

Example #1
0
        private void resimleriKaristir()
        {
            tokenstate.Clear();
            // hamle sifirlanir - baslangic
            hamle       = 0;
            label2.Text = hamle.ToString();
            // hamle siniflanir - bitis
            this.panel1.Controls.Clear(); // paneldeki tüm elemanlar silinir.
            int       left = 0;
            int       top  = 0;
            Random    rnd  = new Random();
            ArrayList gen  = new ArrayList(zorluk * zorluk);

            for (int i = 0; i < zorluk * zorluk; i++)
            {
                int yeniResimIndis = rnd.Next(0, zorluk * zorluk);
                while (gen.Contains(yeniResimIndis))
                {
                    yeniResimIndis = rnd.Next(0, zorluk * zorluk);
                }
                PictureBox pic = (PictureBox)pboxlar[yeniResimIndis];
                pic.Location = new Point(left, top);
                this.panel1.Controls.Add(pic);
                tokenstate.Add(pic.Tag, i);
                gen.Add(yeniResimIndis);
                left += en / zorluk;
                if ((i + 1) % zorluk == 0)
                {
                    left = 0;
                    top += boy / zorluk;
                }
            }
        }
All Usage Examples Of System.Collections.Hashtable::Clear