Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
CSharp /
20180405iZipint[] numbers = {1, 2, 3, 4}; string[] words = {"one", "two", "three"}; foreach (var t in numbers.Zip(words, Tuple.Create)) { Console.WriteLine(t); } (1, one) (2, two) (3, three) With value unpacking: int[] numbers = {1, 2, 3, 4}; string[] words = {"one", "two", "three"}; foreach ((var n, var w) in numbers.Zip(words, Tuple.Create)) { Console.WriteLine("{0} -> {1}", n, w); } 1 -> one 2 -> two 3 -> three You can also write |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |