I have a Dictionary object that is formed using a double as its key. It looks like this:
Dictionary<double, ClassName> VariableName = new Dictionary<double, ClassName>();
I’m using double as the key type as I require the keys to look like this: 1.1, 1.2, 2.1, 2.2, etc.
Everything in my system works great except when I want to delete all the keys in a group e.g., all the 1 values would be 1.1, 1.2, etc.
I can delete rows if I know the full value of the key e.g., 1.1 but in my system I will only know the whole number.
I tried to do the following but get an error:
DictionaryVariable.Remove(j => Convert.ToInt16(j.Key) == rowToEdit).OrderByDescending(j => j.Key);
Is there anyway to remove all rows per int value by converting the key?
Try this: