Converting arraylist to string array

  • Thread starter Thread starter Andrew Banks
  • Start date Start date
A

Andrew Banks

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
 
c:\inetpub\wwwroot\Consolejunkies\Global.asax.cs(71): 'string' denotes a
'class' where a 'variable' was expected
 
GetType is a method on the Object class and does not accept any parameters.
Try using "typeof" instead of "GetType".
 
Peter, Rajiv,

I'm struggling to see what the solution for this could be.

Is there a way to convert a ArrayList to a string array - string[]

Your help is appreciated
 
string[] rolelistarray = (string[])rolelist.ToArray(typeof(string));

Greetings
Martin
 

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