I have dictionary containing key value pairs.
SortedDictionary dictionary=new SortedDictionary();
dictionary.Add(1,33);
diction
How about this? I havent tested it though, but should give something to start think in this direction. Hope it helps.
int input = 4;
List lKeys = dictionary.Keys.ToList();
int reqIndex = lKeys.IndexOf(input) - 1;
int reqAnswer = dictionary[reqIndex];
test for other conditions like if (reqIndex != -1) etc..