It turns out that the only place where I need to convert the
StringCollection to ClientList is in a line such as:
dim sc as StringCollection
dim cl as ClientList
' do some processing that may or may not create an actual StringCollection
if sc is Nothing then cl = new ClientList else cl = new ClientList(sc)
The code in this application is littered with cl.Contains, which as I stated
in another clarification post, sometimes needs to always return true (this
is actually part of a web-site and internal users get additional features)
I ended up implementing ClientList.New(StringCollection) by interating
through the collection and adding it to mybase.items.
Thanks for all the feedback.
Mike Ober.
"Tom Leylan" <tl*****@nospam.netwrote in message
news:ua**************@TK2MSFTNGP06.phx.gbl...
>I suppose I was a bit too cryptic. A StringCollection isn't a ClientList
so unless something changes in the way OOP is implemented in DotNet I don't
think you'll just pass a reference and have it magically connect up.
You can copy the elements in the StringCollection into the ClientList and
probably fairly quickly using CopyTo and AddRange(). I could be mistaken
but I don't think you'll find syntax that will permit what you are hoping
to do.
Tom
"Michael D. Ober" <obermd.@.alum.mit.edu.no.spamwrote in message
news:za******************@newsread1.news.pas.earth link.net...
>Business Rules create the need.
Mike.
"Tom Leylan" <tl*****@nospam.netwrote in message
news:eK**************@TK2MSFTNGP06.phx.gbl...
>>>I guess the standard question is "why?" You'll agree that a
StringCollection <ClientList, so what creates the "need?"
"Michael D. Ober" <obermd.@.alum.mit.edu.nospamwrote in message
news:u2**************@TK2MSFTNGP02.phx.gbl...
I have a class:
Private Class ClientList
Inherits StringCollection
Public InternalUser As Boolean = False
Public Shadows Function Contains(ByVal ClientNumber As String) As
Boolean
If InternalUser Then Return True
Return MyBase.Contains(ClientNumber)
End Function
End Class
I need to do the following:
dim mClientList as ClientList
dim mStringCollection as new StringCollection
mClientList = mStringCollection.
What do I do to my class definition to allow this? Option Strict On
flags this as an illegal implicit conversion. I'm open to using
mClientList = new ClientList(mStringCollection) as well.
Thanks,
Mike Ober.