Lucvdv wrote:
Maybe a dumb question (if those exist), but how do you...
Private m_Stuff As New System.Collections.ArrayList
Public ReadOnly Property Stuff() As System.Collections.ArrayList
Get
Return m_Stuff
End Get
End Property
disable the Add and AddRange methods (or something similar), so the
property becomes a read-only array/list in addition to being one that can't
be replaced?
Implement enumeration yourself, or is there an easier method?
The Framework authors have done this for you. ArrayList (in common with
many other collections, I think) has a Shared method called ReadOnly
which:
Returns a list wrapper that is read-only.
Overload List
Returns a read-only ArrayList wrapper.
[Visual Basic] Overloads Public Shared Function ReadOnly(ArrayList) As
ArrayList
Returns a read-only IList wrapper.
[Visual Basic] Overloads Public Shared Function ReadOnly(IList) As
IList
--
Larry Lard
Replies to group please