Flatten IEnumerable; understanding generics
First, you don’t need Flatten(); that method already exists, and is called SelectMany(). You can use it like this: IEnumerable<IEnumerable<int>> foo = new [] { new[] {1, 2}, new[] {3, 4} }; var bar = foo.SelectMany(x => x); // bar is {1, 2, 3, 4} Second, your first attempt doesn’t work because generic type inference … Read more