Lambda expression to convert list int to list string
List<int> lstNum = new List<int>(new int[] { 3, 6, 7, 9 });
You can use the following to convert a List of int to a List of string:
List<string> lstStr = lstNum.ConvertAll<string>(x => x.ToString());
No need for lambda:
var lstNum = new [] { 3, 6, 7, 9 }.ToList();
var lstStr = lstNum.ConvertAll(Convert.ToString);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With