Convert

public static IEnumerable<TDestination> Convert<TSource, TDestination>(this IEnumerable<TSource> enumerable, Func<TSource, TDestination> converter)
        {
            if (enumerable == null)
            {
                return null;
            }

            List<TDestination> items = new List<TDestination>();

            foreach (TSource item in enumerable)
            {
                items.Add(converter(item));
            }

            return items.ToArray();
        }
Example:
int[] integers = new int[] { 5, 25, 50, 100 };
string[] strings = integers.Convert(i => i.ToString());

Description

Converts from one type to another.

Details

Double click on the code to select all.

 

;