.net framework interface implementation

  • Thread starter Thread starter chan
  • Start date Start date
C

chan

Hi,

I created a class that implements the
System.Collections.IDictionary interface and I declared
methods for implementing IDictionary, and also the
interfaces it inherited from, include ICollection and
IEnumerable.

I have problem in compiling my class and the C# compiler
complained about the method GetEnumerator(), which has
been implemented twice. I looked at the interfaces again
and found that both IEnumerable and IDictionary have this
method declared and I had both implemented. The one
declared in IEnumerable is :

public IEnumerator GetEnumerator();

and the one declared in IDictionary is:

public IDictionaryEnumerator GetEnumerator();

I tried to remove the IEnumerable.GetEnumerator
implementation but then the C# complains on the
incomplete implementation of the interface. Of course
same thing happened when I tried to remove the
IDictionary.GetEnumerator implementation. Therefore I
could remove neither of them.

I believe this could be a simple issue but I just don't
know how to resolve this problem. Any help out there is
appreciated.

Thanks in advance
 
IDictionaryEnumerator IDictionary.GetEnumerator()
{
......
}
IEnumerator IEnumerable.GetEnumerator()
{
........
}

anyway, you have to cast to the specific interface on use.



--
Horatiu Ripa
Software Development Manager
Business Logic Systems LTD
21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
Phone/Fax: +40 264 590703
Web: www.businesslogic.co.uk

This email (email message and any attachments) is strictly confidential, possibly privileged and is intended solely for the person or organization to whom it is addressed. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please inform the sender immediately before deleting it. Business Logic Systems Ltd accepts no responsibility for any advice, opinion, conclusion or other information contained in this email or arising from its disclosure.
 
Thank you Horatiu.
-----Original Message-----
IDictionaryEnumerator IDictionary.GetEnumerator()
{
......
}
IEnumerator IEnumerable.GetEnumerator()
{
........
}

anyway, you have to cast to the specific interface on use.



--
Horatiu Ripa
Software Development Manager
Business Logic Systems LTD
21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
Phone/Fax: +40 264 590703
Web: www.businesslogic.co.uk

This email (email message and any attachments) is
strictly confidential, possibly privileged and is
intended solely for the person or organization to whom it
is addressed. If you are not the intended recipient, you
must not copy, distribute or take any action in reliance
on it. If you have received this email in error, please
inform the sender immediately before deleting it.
Business Logic Systems Ltd accepts no responsibility for
any advice, opinion, conclusion or other information
contained in this email or arising from its disclosure.
 
Back
Top