Bug? Collection Test

BarryW

Active Member
Licensed User
Longtime User
Code: Copy
    'This works fine
    Dim l As List
    l.Initialize
    l.Add(1)
    l.Add(2)
    l.Add(3)
    l.Add(4)
    l.Add(5)
    l.Add(6)
    l.Add(7)
    l.Add(8)
    l.Add(9)
    l.Add(0)
    l.RemoveAt(0)
   
    'This gives an error
    Dim l As List
    l.Initialize2(Array As String(1,2,3,4,5,6,7,8,9,0))
    l.RemoveAt(0)
   
    'This gives an error
    Dim l As List
    l = Array As String(1,2,3,4,5,6,7,8,9,0)
    l.RemoveAt(0)

    Dim m As Map
    m.Initialize
    m.Put("1", "1")
   
    'This will return null
    Log(m.Get(1))
   
    'This will log fase
    Log(m.Get("1") = 1)
   
    'This wil log true
    Log(m.Get("1") * 1 = 1)

Is this bug?
 
The point is that the list can not be changed in size when you define the list as an array

Note that if you pass a list to this method then both objects will share the same list,
and if you pass an array the list will be of a fixed size. Meaning that you cannot later add or remove items.
 
Therefore string "1" is not equal to int 1?
A string with the value of "1" will only be equal to a numeric 1 if the first operand type is known during compilation.
Code: Copy
Dim o1 As Object = 1
Dim o2 As Object = "1"
Log(o1 = o2) 'false
Log(o1 = 1) 'true
Log(o2 = "1") 'true
Log(1 = "1") 'true
Dim s As String = o1
Log(s = 1) 'true
Dim i As Int = o1
Log(i = o2) 'true

For further discussions please start a new thread in the questions forum.
 
Back
Top