I'm having an issue that if a user enters a none existing catagory or typing error, and that catagory is not listed it causes the application to crash. I've narrowed it down to this particular piece of code but want to know what type of condition I can use that if the instance "key" cannot be found to throw an exemption.
This is what I have so far...
myDecryptor.DomainKey key = myDecryptor.DomainKey.Instance[dmCategory.ToLower()] //what I've added
if (key) //looking for a condition that would throw this exception if key is not found
{
throw new Exception();
}