/// <summary> /// <para/>Invokes provided function on each element and returns list of results. /// <para/>Throws if <paramref name="func"/> invocation throws. /// </summary> /// <param name="source">Collection to loop through. If null - return empty <see cref="List{K}"/>.</param> /// <param name="func">Function that will be invoked for each element in <paramref name="source"/>. If null - returns empty <see cref="List{K}"/></param> /// <returns>Returns <see cref="List{K}"/> of results of <paramref name="func"/> invocations on <paramref name="source"/></returns> public static List <K> ForEach <T, K>(this IEnumerable <T> source, Func <T, K> func) { return(source.ForEachF(func)); }