.Net Linq ConvertAll<> Example

using System;
using System.Collections.Generic;

namespace CsharpLinqConvertAllExample
{
    class Program
    {
        static void Main(string[] args)
        {

            var intList = new List<int>
                              {
                                  1,
                                  2,
                                  3,
                                  4,
                                  5
                              };

            var stringList = intList.ConvertAll(x => x.ToString());

            stringList.ForEach(Print);

            Console.ReadKey();
        }

        private static void Print(object obj)
        {
            Console.WriteLine(obj);
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *