Conversion from List<Object> to String[]

Hello ,

I actually wanted to know how I could convert List to String .
I have my result in a List from Collections and now i want it as a array of string.
How could I possibly do that?

Thank You,
Anusha

Hi @Anusha_Makam,

Using assign activity and the Linq query “yourList.ConvertAll(function(x) x.ToString).ToArray()”

Try this.

7 Likes

How do you do it the other way around? from array to list?

thanks

1 Like

Hi @Ilona_Shishov,

List<object> to String[] use below code

String[] to List<object> use below code

"new List(of Object)(arrVariable)"

Regards,
Arivazhagan A

“yourList.ConvertAll(function(x) x.ToString).ToArray()”

i tried using this method to fetch an item from an array starting with a curtain string,

i get an error message “‘Where’ is not a member of ‘system.array’”

i get the same error message for List after converting my array to a list

appreciate your help

Hi @Ilona_Shishov,

can i know the list<Object> values

Regards,
Arivu

its a list of strings,
i basically got the body of an email and split it by new line
now i need the line that starts with the string “city”

thanks

If its list<of string> you can directly convert into array using list.ToArray()

the issue is that i cant manage to get this working for either list nor array
“yourList.ConvertAll(function(x) x.ToString).ToArray()”

Hello @Ilona_Shishov

Can you tell me what error are you getting while using this code ?

Try this code List_of_object.Select(Function(r) cstr(r) ).toarray

OR

List_of_object.Select(Function(r) Convert.ToString(r) ).toarray

1 Like

Thank you!!