shulzan

shulzan

  • NA
  • 1
  • 0

foreach and DictionaryBase

Jul 4 2004 5:36 PM
Hi everyone! I derived several strongly typed key-and-value collections from DictionaryBase following the instructions on msdn. Everything works fine until I try using a foreach statement to access all of their members. An InvalidCastException gets thrown on every attempt. Do I have to implement the IEnumerable interface in my custom types even though it is implemented under DictionaryBase? I figured out that I didn't have to since the "Current" property of the Enumerator returned an object and the foreach statement specified the type to which those objects should be cast. Any help would be greatly appreciated. Don't hesitate to request my code if necessary. Thanks!