Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# zip method

$
0
0

hi all,

i have two arrays as follows

using System;
using System.Linq;

class Program
{
    static void Main()
    {
	// Two source arrays.
	var array1 = new int[] { 1, 2, 3, 4, 5 };
	var array2 = new int[] { 6, 7, 8, 9, 10 };

	// Add elements at each position together.
	var zip = array1.Zip(array2, (a, b) => (a + b));

	// Look at results.
	foreach (var value in zip)
	{
	    Console.WriteLine(value);
	}
    }
}

i implement the above code but i got a below reference error

Error1'System.Array' does not contain a definition for 'Zip' and no extension method 'Zip' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

can anyone help me

answer in advance


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>