Leaders snarfblam Posted April 11, 2005 Leaders Posted April 11, 2005 The IList interface provides the property Item(Index As Integer) As Object, which is read/write. Many classes that implement IList, however, have an Item property which is of a different type and read-only (System.Windows.Forms.Control.ControlCollection and System.Windows.Forms.ListView.ListViewItemCollection for example). If you cast one of these collections to IList, then you can access the property Item(Index As Integer) As Object, but otherwise this property does not show up in intellisense or the object browser. I am making my own collection, which implements IList. How can I reproduce this? [Edit]Also note that this also applies to other members of IList, such as Add, and Insert, not just Item.[/Edit] Quote [sIGPIC]e[/sIGPIC]
HJB417 Posted April 11, 2005 Posted April 11, 2005 13.4.1 Explicit interface member implementations Quote
Leaders snarfblam Posted April 12, 2005 Author Leaders Posted April 12, 2005 Nice... only one problem though... I'm using VB. Quote [sIGPIC]e[/sIGPIC]
HJB417 Posted April 12, 2005 Posted April 12, 2005 system.array class using lutz's decompiler Private Function System.Collections.IList.Add(ByVal value As Object) As Integer Implements IList.Add Throw New NotSupportedException(Environment.GetResourceString("NotSupported_FixedSizeCollection")) End Function Private Sub System.Collections.IList.RemoveAt(ByVal index As Integer) Implements IList.RemoveAt Throw New NotSupportedException(Environment.GetResourceString("NotSupported_FixedSizeCollection")) End Sub Quote
Leaders snarfblam Posted April 12, 2005 Author Leaders Posted April 12, 2005 There we go. Thanks. It seems kinda obvious but I actually tried it. The code editor marked the line as having an error, and I assumed it was because I implemented a function privately when it was actually something else. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.