?
Solved

Array to ArrayList in Property of Class

Posted on 2006-10-27
1
Medium Priority
?
304 Views
Last Modified: 2012-06-22
I have one-dimensional and two-dimensional arrays to convert to ArrayList instead. What would be the equivalent code for:

    Private _mySmallArray(10) As Single
    Public Property MySmallArray As Single()
        Get
            Return _mySmallArray
        End Get
        Set(ByVal Value As Single())
            _mySmallArray = Value
        End Set
    End Property

    Private _myBigArray(10, 10) As Single
    Public Property MyBigArray() As Single(,)
        Get
            Return _myBigArray
        End Get
        Set(ByVal Value As Single(,))
            _myBigArray = Value
        End Set
    End Property

That way, I can still do things like:

 MySmallArray(3) = 3.33
 MyBigArray(4,5) = 4.5
0
Comment
Question by:GivenRandy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
Xeavn earned 2000 total points
ID: 17821947
Why are you trying to convert to an Arraylist? It looks like you are making pretty good use of the regular arrays, is there a reason for wanting to switch?

For the single array you can switch by doing

Private _myArrayList As Arraylist
Protected Property alSmallArray As ArrayList
   Get
      If _myArrayList Is Nothing Then
         _myArrayList = New ArrayList()
      End If
      Return _myArrayList
   End Get
   Set(ByVal Value As ArrayList)
      _myArrayList = Value
   End Set
End Property 'alSmallArray

alSmallArray.Item(3) = 3.33

Not sure how you would even make ArrayList work for a 2 Dimensional Array.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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