473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

.net framework interface implementation

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
Nov 15 '05 #1
2 1335
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.

"chan" <ga******@hotmail.com> wrote in message news:01****************************@phx.gbl...
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

Nov 15 '05 #2
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, RomaniaPhone/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.
"chan" <ga******@hotmail.com> wrote in message

news:01****************************@phx.gbl...
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

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Soon | last post by:
Hi, I am new to C# and have a question regarding interface implementation in C#. In the COM days, we can have multiple COM objects implementing the same interface and instantiating one of them...
12
by: Steve W. | last post by:
I just read the section (and did the exercise) in the C# Step by Step book that covers Explict Interface Implementation (where you specify in the method implementation the specific interface that...
5
by: Keith Patrick | last post by:
Could someone tell me if it's possible (and if so, how) to call an explicitly-implemented interface method from a subclass? I have a class in which I have to explicity implement some methods, but...
2
by: COLIN JACK | last post by:
Hi All, I've got a situation where I'm implementing an interface (BaseInterface in example below) and I want to use explicity interface implementation of an event so that I can add type safety. ...
0
by: Brandon Driesen | last post by:
The following illustrates my question. Why is it when I bind to an a collection of items whose interface implementation is explicit, there is an error during the binding process wherein the error...
17
by: Galian | last post by:
Hi all. I have some questions about interface implementation, if anybody can help me, I will be very thank. So: If i have some interface IA: class IA { virtual void SomePureVirtFunc() = 0;...
7
by: Mukesh | last post by:
Hi, Consider a situation where a class (Say C1) is implementing two interfaces (I1, I2). Both the interface contains a method (M1) with the same signature. class C1:I1, I2 { //implementation...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i am looking for an example that shows how to implement a COM Interface (with events) and pass it to a Windows API Call via pointer. Since this is really new to me, i dont know where to...
2
by: puzzlecracker | last post by:
I don't see the purpose of explicit interface implementation other than to hide its signature in the class that implements it, and, instead, write your own, perhaps with a different signature,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.