ok, maybe it’s not a method exactly. here’s what I’d like to do:
Private _Columns As ArrayList
Public Property Columns() As ArrayList
Get
Return _Columns
End Get
Set(Cols As ArrayList)
_Columns = Cols
End Set
Set(Cols As MyOwnList)
_Columns = New ArrayList
For Each o As MyObj in Cols
_Columns.Add(o.Column)
Next
End Set
End Property
which would allow me to conveniently set the property by assigning to it various kinds of collection types… except, I can’t do it because apparently the Set method has to take an argument of the type of the property itself… I get the complaint:
‘Set’ parameter must have the same type as the containing property
is there a way to do this?
It’s not really overloading but the following could offer a (temporary) workaround:
I think this is as close as you can get to real overloaded properties…
EDIT
I believe the proper way to do what you’re trying to achieve is to define a
ToArrayList()method on yourMyOwnListclass.and set your property like this:
If you don’t have access to the source code of the class, you can still achieve this through extension methods.