开发者

What does Array as Object mean in Basic4Android?

开发者 https://www.devze.com 2023-04-10 16:29 出处:网络
SQL1.ExecNonQuery2(\"INSERT INTO table1 VALUES(?,?,?)\",Array As Object(\"def\",3,4)) I don\'t seem to understand why the argument list in the above statement is declared in the form of Array as Obj
SQL1.ExecNonQuery2("INSERT INTO table1 VALUES(?,?,?)",Array As Object("def",3,4))

I don't seem to understand why the argument list in the above statement is declared in the form of Array as Object('xx','xx''xx').How is it 开发者_运维问答exactly being converted into a list parameter ?


Array As xxx is a shorthand syntax for declaring a new array and assigning the values.

Array As Object("def", 3, 4)

Is equivalent to:

Dim arr As Object(3)
arr(0) = "def" : arr(1) = 3 : arr(1) = 4

Basic4android automatically wraps arrays as lists when needed. The items are not copied, it is the whole array that is wrapped in a list. Therefore the above code is valid as it creates an array which is then wrapped as a List.

0

精彩评论

暂无评论...
验证码 换一张
取 消