IList implementation problems (typed collections)

G

Guest

This is the first time I am implementing strongly typed collections. And in
order to do this I overloaded the IList functions to implement them ( an
explicit interface implementation of IList). All is fine till the point where
i want to strongly type the Item property. This is the error it gives me:
C:DataObject\dUserTypeCollection.vb(81): 'Public Default Property Item(index
As Integer) As Object' and 'Public Default Property Item(index As Integer) As
dUserType' cannot overload each other because they differ only by return
types.

In my usertypecollection class i am implementing the following:
System.ComponentModel.IListSource, IList, IEnumerable
 
R

Ryan Byington

You just need to rename the member that implements IList.Item like the
following:

public property IList_Item(index as Integer) as Object implements
IList.Item
get
throw new NotSupportedException()
end get
set
throw new NotSupportedException()
end set
end property

public property Item(index as Integer) as Customer
get
throw new NotSupportedException()
end get
set
throw new NotSupportedException()
end set
end property

Ryan Byington [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

--------------------
 

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