Have you tried SelectMany?
var result = from left in dataSet.Tables[leftTableName].AsEnumerable() from right in dataSet.Tables[rightTableName].AsEnumerable() where left.Field<string>(leftComparedColumnName).Contains(right.Field<string>(rightComparedColumnName)) select new { left, right };
Edit:
The following should have the desired effect:
class ContainsEqualityComparer: IEqualityComparer<string> { public bool Equals(string right, string left) { return left.Contains(right); } public int GetHashCode(string obj) { return 0; } } var result = dataSet.Tables[leftTableName].AsEnumerable().GroupJoin( dataSet.Tables[rightTableName].AsEnumerable(), left => left, right => right, (left, leftJoinedResult) => new { left = left, leftJoinedResult = leftJoinedResult }, new ContainsEqualityComparer());
Key comparison is done through the custom IEqualityComparer. Two lines will only be joined when GetHashCode () on the left and on the right matches, and Equals returns true.
Hope this helps.
source share