If I were having a Generic list I would have done some thing like this
myListOfObject.FindAll(x=>(x.IsRequired==false));
What if I need to do similar stuff in Hashtable? Copying to temporary hashtable and looping and comparing would be that last thing I would try 🙁
Firstly, use
System.Collections.Generic.Dictionary<TKey, TValue>for better strong-type support as opposed toHashtable.If you need to just find one key or one value, use the methods
ContainsKey(object key)orContainsValue(object value), both of which are found on theHashtabletype.Or you can go further and use linq extensions on the
Hashtableparts: