Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert List of longs to string array

Tags:

arrays

c#

list

What is the best way to convert a List of primitive longs to an array of strings?

I think I'm looking for something fancier than writing my own loop, etc..

like image 871
Chris Avatar asked Dec 02 '22 07:12

Chris


1 Answers

This should do the trick:

string[] arr = list.Select(l => l.ToString()).ToArray();
like image 82
Ahmad Mageed Avatar answered Dec 22 '22 00:12

Ahmad Mageed