473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Converting ArrayList to String Array

Is it possible to convert an ArrayList to a string array?

I have a routine that takes a string array as a parameter,
converts it to an ArrayList for manipulation purposes,
and now I need to convert it back to a string array.

example of code I am using:

Sub MakeChanges(byval strChange() as string) as string()
Dim aryValue As ArrayList = New ArrayList(strChange)
aryValue.add "newvalue"

' here I want to convert the aryValue back to a string()
End Sub

-Walt Zydhek
Jul 21 '05 #1
1 4607
Walter Zydhek <wa**@giftmarket.org> wrote:
Is it possible to convert an ArrayList to a string array?

I have a routine that takes a string array as a parameter,
converts it to an ArrayList for manipulation purposes,
and now I need to convert it back to a string array.

example of code I am using:

Sub MakeChanges(byval strChange() as string) as string()
Dim aryValue As ArrayList = New ArrayList(strChange)
aryValue.add "newvalue"

' here I want to convert the aryValue back to a string()
End Sub


Yes - look at ArrayList.ToArray (Type). You'll need to cast the
reference returned to a string array.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Graeme Downes | last post by:
I have a string of integer, such as the following: "12 24 12 9 2" and I want to convert this into an array or arraylist which will seperate the string into an array of integers. How do I do...
5
by: Andrew Banks | last post by:
Can anyone see aproblem with this line of code string rolelistarray = rolelist.ToArray(GetType(System.String)); I'm getting a problem with the GetType(System.String) section
1
by: Yama | last post by:
Hi, I would like to convert (box and unbox) a string to ArrayList type. I tried the following: string arrayHeaderInfo = new string; stringHeaderSplitted = stringHeader.Split(","); ...
1
by: Alexander Widera | last post by:
hello, how can I convert a hashtable to an arraylist or array? I want to sort the hashtable... but this isn't posible, so i have to convert it to an hashtable. thank you, alex
6
by: rdi | last post by:
I have 3 classes: mailBox, mailFilter & mailFilterSet I then have an arraylist. Each element in the array is of type mailBox (variable name is mbox). One item of the mailbox class is an...
1
by: Walter Zydhek | last post by:
Is it possible to convert an ArrayList to a string array? I have a routine that takes a string array as a parameter, converts it to an ArrayList for manipulation purposes, and now I need to...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
9
by: Terry | last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces. One of the major uses is to be able to split out Read-only access to an obect. Let me give you a simple (contrived)...
5
by: stephen | last post by:
Hi, I have been working using VB .NET and I wanted to convert a code to C# in VB .Net I use modules so that I can declare variables, STP holders so that I can replace them easily when I move b/w...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.