using System.Collections.Generic;
public static void Main()
var squares = ((IEnumerable<int>)null).Accumulate(x => x * x);
Console.WriteLine("This is fine.");
public static class AccumulateExtensions
public static IEnumerable<U> Accumulate<T, U>(this IEnumerable<T> collection, Func<T, U> func)
foreach (var item in collection)