[RESOLVED] Passing ArrayLists between subroutines
I am new to the use of ArrayLists and am trying to convert an algorithm to use them in order to save memory. However, I am struggling to achieve error-free code while using "Strict On".
Here is a basic version of the code I am attempting to use.
Code:
Option Explicit On
Option Strict On
Module Program
Sub Main()
Dim P(1) As Structs.Point
P(0).X = 0
P(0).Y = 0
P(1).X = Convert.ToDecimal(1.2345)
P(1).Y = Convert.ToDecimal(1.9876)
Dim AL As New ArrayList()
AL.Add(100)
Dim AL1 As New ArrayList()
AL1.Add(P(0))
AL1.Add(P(1))
Dim AL2 As New ArrayList()
AL2.Add("A")
AL2.Add("B")
AL2.Add("C")
AL2.Add("D")
Dim AL3 As New ArrayList()
AL3.Add(True)
AL3.Add(False)
AL.Add(AL1)
AL.Add(AL2)
AL.Add(AL3)
Call Tester(AL)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Sub Tester(ByRef AL As ArrayList)
Dim a As New ArrayList
a = AL(2)
Console.WriteLine(a(2))
If (AL(1)(0)).X < (AL(1)(1)).X Then
Console.WriteLine(Convert.ToString((AL(1)(1)).X))
End If
End Sub
End Module
Class Structs
Public Structure Point
Public X As Decimal
Public Y As Decimal
End Structure
End Class
It works when I do not use the Strict option. How do I improve the code to compile error-free?
SharpDevelop 3.1
.NET Framework 3.5
Windows XP (SP3)