|
-
Jun 18th, 2003, 07:50 AM
#1
Thread Starter
New Member
Problem implementing the IDictionary Interface
I am trying to implement the IDictionary interface in a class and the framework is telling me to implement the Overridable Overloads Function GetEnumerator() as IDictionaryEnumerator method. If I add it using the drop down combo at the top of the editor it inserts the method for me.
However the class still has an error because it also wants me to implement Overridable Overloads Function GetEnumerator() as IEnumerator. Obviously I can't do this because the methods only differ by return type!! Has anyone else encountered this problem or does someone know of a solution ?
Thanks in advance
-
Jun 18th, 2003, 09:09 AM
#2
Obviously I can't do this because the methods only differ by return type!!
Umm yes you can. Do exactly what it tells you to do.
-
Jun 18th, 2003, 09:20 AM
#3
Thread Starter
New Member
I have done what it tells me to do and that's what is causing the error !
This is the code I've added to my class.
Code:
<Serializable()> Public Class ReportOutputModelList : Implements IDictionary
Public Overridable Overloads Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
End Function
Public Overridable Overloads Function GetEnumerator() As IDictionaryEnumerator Implements IDictionary.GetEnumerator
End Function
etc...
End Class
It is saying it needs both these methods but having added them I then get the 'cannot overload each other because they differ only by return types.'
-
Jun 18th, 2003, 09:36 AM
#4
Just rename 1 of them. As long as they Implement the correct method, name doesnt matter
-
Jun 18th, 2003, 09:41 AM
#5
Thread Starter
New Member
Thanks Cander.
That wasn't immediately obvious. It must just look for a match on the Implements statement on the method declaration to complete the implementation, I guess !
-
Jun 18th, 2003, 09:45 AM
#6
I could be worng, but they seems to be the case.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|