Link to home
Start Free TrialLog in
Avatar of dkim18
dkim18

asked on

Can I declare the size of property array in vb.net?

Can I declare the size of the array in the Property using the auto implement?


public class MySettings
 public Property LocalRooms() As  new Double (3)  <== I get an error saying there is no Double constructor


End class

Do I need to do it in the constructor?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or something like this:

    Private locRooms() As Double

    Public Property LocalRooms() As Double()
        Get
            Array.Resize(locRooms, 3)   ' Here you can specify array size
            Return locRooms
        End Get
        Set(ByVal value As Double())
            Array.Resize(value, 3)   ' Here you can specify array size
            locRooms = value
        End Set
    End Property

Open in new window

Avatar of dkim18
dkim18

ASKER

Either do full property or initialize it in constructor.

Thanks.