Created
December 19, 2019 04:12
-
-
Save omarrodriguez15/f34b10bdb448df822a831a122ecb25a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Dictionary<T, T> BuildPairwiseDcitionary<T>(this IEnumerable<T> lst) | |
| { | |
| var left = lst.Where((x, i) => i % 2 == 0); | |
| var right = lst.Where((x, i) => i % 2 == 1); | |
| return left | |
| .Zip(right, (x, y) => new { Key = x, Value = y }) | |
| .ToDictionary(x => x.Key, y => y.Value); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment