Changeset 11347
- Timestamp:
- 09/05/14 22:25:15 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common/3.3/EnumerableExtensions.cs
r11309 r11347 96 96 public static IEnumerable<IEnumerable<T>> CartesianProduct<T>(this IEnumerable<IEnumerable<T>> sequences) { 97 97 IEnumerable<IEnumerable<T>> result = new[] { Enumerable.Empty<T>() }; 98 return sequences. Aggregate(result, (current, s) => (from seq in current from item in s select seq.Concat(new[] { item })));98 return sequences.Where(s => s.Any()).Aggregate(result, (current, s) => (from seq in current from item in s select seq.Concat(new[] { item }))); 99 99 } 100 100 }
Note: See TracChangeset
for help on using the changeset viewer.