2D array & arraylist class

Results 1 to 3 of 3

Thread: 2D array & arraylist class

  1. #1
    Join Date
    Dec 1969

    Default 2D array & arraylist class

    I have been fooling around with 2D arrays, but I don't believe a 2D array can inherits the properties like INDEXOF, ADD, and others from the arraylist class. Can anyone tell me definitively if this is true? If you can how would I do it.

  2. #2
    Join Date
    Dec 1969

    Default RE: 2D array & arraylist class

    That&#039;s because the Array and the ArrayList are two different classes. An array is designed to be fixed length so there is no .Add method.<BR><BR>What you can do is substitue an ArrayList where you are currently using an Array. Or you can create an ArrayList using the ArrayList(ICollection) constructor:<BR><BR>ArrayList arr = new ArrayList(arrayInstance);<BR><BR><BR>Maybe check out the other classes in System.Collections also and you might find one better suited to your task.<BR><BR>Hope this helps,<BR>shai

  3. #3
    Join Date
    Dec 1969

    Default How about an ArrayList of Arrays?

    That gets you the functionality of an ArrayList for the "outer array" yet allows the convenience and predictability of simple arrays for the "inner arrays".<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts