Custom Sequence Operators
Combine
This sample uses a user-created sequence operator, Combine, to calculate the dot product of two vectors.Code:
public void DataSetLinq98() { var numbersA = testDS.Tables["NumbersA"].AsEnumerable(); var numbersB = testDS.Tables["NumbersB"].AsEnumerable(); int dotProduct = numbersA.Combine(numbersB, (a, b) => a.Field("number") * b.Field ("number")).Sum(); Log.WriteLine("Dot product: {0}", dotProduct); }