C# Archives : Binary Bits https://blog.binarybits.net/tag/c/ Bits & Pieces - A blog by Kannan Balasubramanian Thu, 06 Sep 2012 06:51:47 +0000 en-GB hourly 1 https://wordpress.org/?v=6.5.2 Convert List<int> to List<string> in C# https://blog.binarybits.net/convert-listint-to-liststring-in-c/ https://blog.binarybits.net/convert-listint-to-liststring-in-c/#respond Thu, 06 Sep 2012 06:25:23 +0000 https://blog.binarybits.net/?p=360 I was faced with a micro challenge, of converting a List<int> to List<string>. After struggling for some time, decided to Google and found the the following solution ! List intList = new List(); List stringList = new List(); for (int i = 0; i < 10; i++) intList.Add(i); stringList = intList.ConvertAll(delegate(int i) { return i.ToString(); […]

The post Convert List<int> to List<string> in C# appeared first on Binary Bits.

]]>
I was faced with a micro challenge, of converting a List<int> to List<string>. After struggling for some time, decided to Google and found the the following solution !

List intList = new List();
List stringList = new List();

for (int i = 0; i < 10; i++)
	intList.Add(i);

stringList = intList.ConvertAll(delegate(int i) { return i.ToString(); });

Source: http://stackoverflow.com/questions/44942/cast-listint-to-liststring-in-net-2-0

The post Convert List<int> to List<string> in C# appeared first on Binary Bits.

]]>
https://blog.binarybits.net/convert-listint-to-liststring-in-c/feed/ 0