IList implementation problems (typed collections)

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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

--------------------
 
Back
Top