there is a method that receives an int parameter and returns a string by checking parameter through a set of if…else statements :
if(param == 1)
{
return "1";
}
else if(param ==20)
{
return "20";
}
else
{
if(param <= 10)
{
return "below 10";
}
else if(param <= 30 )
{
return "below 30";
}
...
}
I wonder if it is possible to put these “>= , <=” conditions in a dictionary
You can use
Dictionary<Func<int, bool>, string>:Edit:
Comment from @Maarten is correct,
Dictionarydoes not ensure the order of item,ListofKeyValuePairshould be the best this case: