Do Not .IndexOf Without Further Checks
Do not do this:
if ("A,B,C,D,E".IndexOf(key) > -1)
{
// CODE REDACTED
}
If key is an empty string, the result is 0 and the code in the IF block is executed. This is probably not what you expected.
Do not do this:
if ("A,B,C,D,E".IndexOf(key) > -1)
{
// CODE REDACTED
}
If key is an empty string, the result is 0 and the code in the IF block is executed. This is probably not what you expected.