Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Array to ArrayList in Property of Class

Posted on 2006-10-27
1
Medium Priority
?
305 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

598 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