views:

26

answers:

1

I tried to implement IEnumerator< Status > but got errors about two different Properties not being implemented.

'DataReader' does not implement interface member 'System.Collections.Generic.IEnumerator.Current'

'DataReader' does not implement interface member 'System.Collections.IEnumerator.Current'

The solution that worked was:

    public Status Current { get; set; }

    object System.Collections.IEnumerator.Current
    {
        get { throw new NotImplementedException(); }
    }

It looks like I could have multiple Properties with the same name separated by different namespaces.

What is this type of "property overloading" called? And how can I find out more about it.

+4  A: 

The second property implementation is an explicit interface implementation. It specifically implements the property Current for the IEnumerable interface. The reason you need to do this is that the Current property of your class is not the same type (Status vs object), so it doesn't match what the interface dictates.

Fredrik Mörk
And explicitly implemented interface members are only accessible via a reference to the interface, so you need to cast the class reference to the interface type to use them.
Richard