Set al = CreateObject( "System.Collections.ArrayList" )
al.Add "F"
al.Add "B"
al.Add "D"
al.Add "C"
call al.insert(2,"john")
My problem is: I would like to create a multi dimensional ArrayList. It is
quite a normal thing in C# but I really can't find out wich is the correct
syntax in VBScript.
I'm persuaded that it should be possible to do that; one is supposed to be
able to use any kind of feature of the .NET class even in VBScript... Is
there anyone who can provide a working code for my needs ?
I thank you in advance for any help.
Newcomsas
I would say that trying to get the net framework objects to
work with vbscript could be challenging.
Have you thought about using the "dictionary object"? While
it appears to be one-dimensional, you could make it 2-D by
making each item in the dictionary an array.
Or, you could even stretch it to 3-D, 4-D, and so on, by
making the arrays, as arrays-of-arrays.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
The "Scripting.Dictionary" object is somewhat similar to your object...
I'm not familiar with "ArrayList" so I Google'd it and found this link:
The Beginner's Guide to an ArrayList
http://aspnet101.com/aspnet101/tutorials.aspx?id=24
which starts out with:
"The Beginner's Guide to an ArrayList An ArrayList, at first glance
might be kind of hard to get your head around, if you're a beginner
programmer, or coming from the Classic ASP/HTML world."
Check it out and see if it helps you.
Are you sure? According to my documentation:
************************************************************************
***
An Array can have multiple dimensions, while an ArrayList or a List
always has exactly one dimension
************************************************************************
***
Are you sure you haven't gotten used to creating arraylists of arrays or
arraylists?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
I doubt that:
"An Array can have multiple dimensions, while an ArrayList or a List<(Of <(T>)>)
always has exactly one dimension."
(http://msdn2.microsoft.com/en-us/library/41107z8a.aspx)
> I'm persuaded that it should be possible to do that; one is supposed to be
> able to use any kind of feature of the .NET class even in VBScript...
Computers are tamed by optimists, but a little bit of realism is needed
too. *Some* objects are exposed to late binding Script languages like
VBScript; *some* of their methods are callable (if you know the correct
sequence number); *some* of their parameters and return value (types)
are usable. So you should suppose, that it doesn't work, and only
after (frustating) research and (careful) testing revoke the pessimistic
statement.
> Is there anyone who can provide a working code for my needs ?
Perhaps, if you specify, what you want to achieve with some more details.
[...]