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
 
Back
Top