Can a Property be an array?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'd like to know if a property can be a array of a structure in VB.NET

I have a structure called sListItem and I need a property to be an array of that type, something like

Public Property ListItems()(10) As sListItem

....that I'd call as

myClass.ListIems(i).an

I am new in VB.NET and I don't know how to declare such thing..

Any idea??

Thanks a lot!!

FO
 
Fernando(?),
Didn't you ask this yesterday?

As Herfried & spamfurnace stated yesterday: yes properties can be arrays.

However you do not give the length on the property itself, you need to use
the following syntax.
Public Property ListItems() As sListItem()

An alternative is to define an Indexed Property. Something like:
Public Property ListItems(index As Integer) As sListItem

Hope this helps
Jay
 
Yes! FOP -> Fernando O. Paes :

Actually I had some kind of trouble posting this yesterday and I couldn't be sure that my topic was ok, that's why I tried in different groups..

and yes, both your comments were very helpful, my routine finally worked

Regards
FO
 
Back
Top