I have a hashtable with id-name value pairs. The id is entered as the key, and the name as the value. I am then searching the table, and returning the key whose value matches a specified string like this: (folderValue is the specified string)
String^ key;
for each (String^ aKey in table.Keys)
{
if ((String^)table.default[aKey] == folderValue)
{
key = aKey;
break;
}
}
My question is, there might be more than one value that matches folderValue. Is there any way to start searching from the most recent entries and back?
TIA
That’s a fairly non-standard way to use a hashtable. How are you using this data? Consider alternate data structures, like perhaps a
List<MyCustomClass>, whereMyCustomClasscontains ID, Name, and implements IComparable that considers a date or other time-based data. Retrieve items from this list, and sort them. Using LINQ against this would give you a nice way to retrieve data.