GetEnumerator and NameObjectCollectionBase

  • Thread starter Thread starter Sam Marrocco
  • Start date Start date
S

Sam Marrocco

I've constructed a class that inherits the NameObjectCollectionBase
class. All works well, but I'd like to shadow the GetEnumerator method
so that it returns an actual value *instead of a DictionaryEntry*.

I've gotten strange errors when attempting to override GetEnumerator,
such as 'GetEnumerator() cannot override 'Public Overridable
NotOverridable Function GetEnumerator() because it is declared
NotOverridable......yes, it actually says it is *overridable
notoverridable*.

Any ideas why this would not work, and what I should do to "modify" my
GetEnumerator()?



--
==================================================================
Sam J. Marrocco
Sr. Visual Effects Artist/R&D
Travelling Pictures/GTN
Inferno, Flame, Maya, All that cool stuff!
"The fact that no one understands you doesn't make you an artist."
==================================================================
 
Instead of Overridable, use Shadows. The one thing to be careful of is that
a Shadowed member only works for the type you declare it in.
For example, if you create class Customers by inheriting
NameObjectCollectionBase, then Shadow GetEnumerator on Customers, your
GetEnumerator will run only on references to Customers. References of type
NameObjectCollectionBase (for example) which point to an instance of
Customers will run the default GetEnumerator defined for
NameObjectCollectionBase.

-Rob Teixeira [MVP]
 
Thanks, I'll try that!
Instead of Overridable, use Shadows. The one thing to be careful of is that


--
==================================================================
Sam J. Marrocco
Sr. Visual Effects Artist/R&D
Travelling Pictures/GTN
Inferno, Flame, Maya, All that cool stuff!
"The fact that no one understands you doesn't make you an artist."
==================================================================
 
Back
Top