v.ToString()).ToArray())." />

How to convert a list of ints to a string array in Linq?

Values. Select(v => v.ToString()).ToArray() or the one liner string blah = string. Join(",", values.

Select(v => v.ToString()).ToArray()).

Values. Select(v => v.ToString()).ToArray(); or the one liner string blah = string. Join(",", values.

Select(v => v.ToString()).ToArray()).

Ha - too easy :) cheers mate! – Pure. Krome Mar 29 '09 at 11:52.

For those reading this question that aren't using LINQ (i.e. If you're not on . NET 3.

X) there's a slightly more complicated method. They key being that if you create a List you have access to List.ToArray(): IList numberList = new List {1, 2, 3, 4, 5}; int intArray = new List(numberList).ToArray(); string blah = string. Join(",", Array.

ConvertAll(intArray, input => input.ToString())); Not very efficient because you're then creating the input data, a List, an int array, and a string array, just to get the joined string. Without . NET 3.

X your iterator method is probably best.

I have a function (tointarray) to convert a string into an array of ints, but I am not very satisfied with it. It does the job but there must be a more elegant way to do this, perhaps Linq could help here. Unfortunately I am not very good in Linq.

Do you guys know a better way?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send