Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Lambda expression to convert list int to list string
List<int> lstNum = new List<int>(new int[] { 3, 6, 7, 9 });
List<string> newList = lstNum.Select(i => Convert.ToString(i)).ToList();
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());
Add a comment
This will work as well:
List<string> lstString = lstNum.Select(x => x.ToString()).ToList();
No need for lambda:
var lstNum = new [] { 3, 6, 7, 9 }.ToList(); var lstStr = lstNum.ConvertAll(Convert.ToString);
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
List<string> newList = lstNum.Select(i => Convert.ToString(i)).ToList();