A btter way to represent Same value given multiple values(C#3.0)
- by Newbie
I have a situation for which I am looking for a more elegant solution.
Consider the below cases
"BKP","bkp","book-to-price" (will represent) BOOK-TO-PRICE
"aop","aspect oriented program" (will represent) ASPECT-ORIENTED-PROGRAM
i.e. if the user enter BKP or bkp or book-to-price , the program should treat that as BOOK-TO-PRICE. The same holds good for the second example(ASPECT-ORIENTED-PROGRAM).
I have the below solution:
Solution:
if (str == "BKP" || str == "bkp" || str == "book-to-price" ) return "BOOK-TO-PRICE".
But I think that there can be many other better solutions .
Could you people please give some suggestion.(with an example will be better)
I am using C#3.0 and dotnet framework 3.5