Getting an Array structure from Class Property

  • Thread starter Thread starter Hugh O
  • Start date Start date
H

Hugh O

Hi,
I am creating a class. I do not have any problem defining the property
statements except when an array is involved. Would someone be able to show
me the correct syntax for a Property statement to Get an entire array
instead of one element of the array.

thanks,
hugh
 
....

Private _items() As String = {"AB", "CD", "EF"}

Public Property Items() As String()
Get
Return _items
End Get
Set(ByVal Value As String())
_items = Value
End Set
End Property



NOTE:
The Set property does not copy the items, it 'drops' the old array and
replaces it with the new one.
In practice I would avoid this.
A readonly property to return the array and then an Add(xxx) function
to add items to the array.

hth
Alan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top