I Have a Hashtable that I dont know What is the content of .
now I want to get one Key and value from it;
I use hashtable because of its speed because content of hashtable is over 4,500,000 KeyValuePair so I cant use GetEnumerator its reduce program speed
You use a
List<TKey>:We are just creating a
List<TKey>whose elements are pointing to the same location in memory as the keys of your hashtable and then we pick a random element from this list.And if you want to get a random element value from the hashtable, this should be pretty straightforward given a random key.