GetEnumerator and NameObjectCollectionBase

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."
==================================================================
 
R

Rob Teixeira [MVP]

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]
 
S

Sam Marrocco

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."
==================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top