Can I declare the size of property array in

Posted on 2012-09-18
Last Modified: 2012-09-19
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?
Question by:dkim18
    LVL 83

    Accepted Solution

    You cant do it with auto implement. Either do full property or initialize it in constructor.
    LVL 19

    Assisted Solution

    by:Shahan Ayyub
    In VS2012, you can do like this:

    which one you are using ?
    LVL 19

    Expert Comment

    by:Shahan Ayyub
    or something like this:

        Private locRooms() As Double
        Public Property LocalRooms() As Double()
                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


    Author Comment

    Either do full property or initialize it in constructor.


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now