Convert

public IEnumerable<TDestination> Convert<TSource, TDestination>(this IEnumerable<TSource> source, Func<TSource, TDestination> conversionFunc)
		{
			foreach (TSource element in source)
			{
				yield return (conversionFunc(element));
			}
		}
Example:
List<string> s = ...;
IEnumerable<int> = s.Convert(s => Convert.ToInt32(x));

Description

Converts all elements in an enumerable list from the its to a destination type by calling a provided conversion function

Details

Double click on the code to select all.

 

;