The given key was not present in the dictionary

Jun 7, 2010 at 9:10 PM

Runing the code and am hitting an error in QuestionType.cs when I create a new quiz

The given key was not present in the dictionary.

public IEnumerable GetErrors(string propertyName)
    {
      return _errors[propertyName];
    }

 The property is DisplayName.

What could cause this?

Aug 9, 2010 at 3:11 PM

I managed to get this working with this code snippet:

 public IEnumerable GetErrors(string propertyName)
    {
        if(_errors.ContainsKey(propertyName))
        {
            return _errors[propertyName];
        }
        return null;
    }
It seems to work for me for now...