[Release]Hashtable

09/20/2008 23:14 plasma-hand#16
omg hashtables are leet

Quote:
Console.WriteLine("Hello World")
Holy shit i did it
09/20/2008 23:18 ~*NewDuuDe*~#17
Quote:
Originally Posted by plasma-hand View Post
omg hashtables are leet



Holy shit i did it
Code:
Console.WriteLine("U R PRO!!!");
Console.ReadLine();
09/20/2008 23:46 THE BAT#18
LOL

use Dictionary<,> instead of Hashtable is you are using .NET 2 or above :D
09/20/2008 23:48 taguro#19
Quote:
Originally Posted by THE BAT View Post
LOL

use Dictionary<,> instead of Hashtable is you are using .NET 2 or above :D
ummmm, k...
09/21/2008 00:31 © Haydz#20
Quote:
Originally Posted by THE BAT View Post
LOL

use Dictionary<,> instead of Hashtable is you are using .NET 2 or above :D
theres always one broken tool in the toolbox :(
10/21/2008 07:27 Tw3ak#21
Or if ya wanted to do hashtables the right way would be something more like this.

Code:
        public Hashtable _allChars = new Hashtable();
        public Hashtable AllChars
        {
            get
            {
                if (this._allChars == null)
                {
                    lock (World.SyncRoot)
                    {
                        if (this._allChars == null)
                        {
                            // Initial capacity of 500 and fastest lookup load factor of 0.1f.
                            // load factor ranges from 0.1f to 1.0f. 0.1f means very fast lookups
                            // but increased memory consumption. It also slows the Add/Remove.
                            // Since world iterates this collection a lot, smallest load factor is necessary.
                            this._allChars = new Hashtable(500, 0.1f);
                        }
                    }
                }
                return this._allChars;
            }
        }
Of course this is how it is done using singleton with standard lock plus double-check with public sealed class rather then those public static ones you all use and get the enumeration errors and null ref errors in the hashtables from world.
10/21/2008 12:11 Rechocto#22
Code:
public Hashtable hash = new Hashtable();
public uint b = 0;
while(true) {
hash.Add(b, b*20);
b++;
}
12/04/2008 18:50 alexbigfoot#23
thank you :*