Array not ArrayList

  • Thread starter Thread starter John Sutor
  • Start date Start date
J

John Sutor

In a web service you cannot pass an ArrayList pback to the calling app.
I want to use an Array, but I will not always know the number of
elements to declare the array. I am simply reading in a file lin by
line and want to put each line in a string array, but each file varies
in the amount of lines it has. Can anyone show me a code snippet of how
to do this?
 
You could create an Array after you have added the items to the ArrayList.

string [] result = (string []) al.ToArray(typeof(string));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top