Answer by PTwr for Compare 2 byte arrays
"Is there a way to do data1-data2 = data3 without enumerating through a loop?" No. It is technically impossible.At best, or rather worst, you can call function that will do enumeration for you. But it...
View ArticleAnswer by Tim Schmelter for Compare 2 byte arrays
Here is another (less readable but maybe a little bit more efficient) approach that does not need LINQ:public static int[] GetDifference(int[] first, int[] second){ int commonLength =...
View ArticleAnswer by Giannis Paraskevopoulos for Compare 2 byte arrays
var data3 = data1.Select((x,i)=>new {x,i}) .Join ( data2.Select((x,i)=>new {x,i}), x=>x.i, x=>x.i, (d1,d2)=>Math.Abs(d1.x-d2.x) ) .ToArray();
View ArticleAnswer by Selman Genç for Compare 2 byte arrays
You are looking for Zip methodvar data3 = data1.Zip(data2, (d1,d2) => Math.Abs(d1 - d2)).ToArray();Enumerable.Zip<TFirst, TSecond, TResult> MethodApplies a specified function to the...
View ArticleCompare 2 byte arrays
I have 2 int arrays.int[] data1 #int[] data2 #I want to create a 3rd int[] data3 which is the differences between the 2 other arrays.Let us take the 1st value in data1.The value is 15 (e.g.).Now let us...
View Article