I'm working with DataSets, specifically with a an array of DataRows:
My question is, how am I able to perform Unions/Intersects of DataRow[]'s WITHOUT using LINQ?
I'm working with DataSets, specifically with a an array of DataRows:
My question is, how am I able to perform Unions/Intersects of DataRow[]'s WITHOUT using LINQ?
Just write code for it:
//Assumes setA and setB are unique internally
public DataRow[] GetUnionRows(DataRow[] setA, DataRow[] setB){
List<DataRow> resultList = new List<DataRow>(setA);
foreach (DataRow row in setB){
if (!Contains(setA, row)){
resultList.add(row);
}
}
return resultList.toArray();
}
private bool YourEquals(DataRow a, DataRow b){
//Whatever
}
private bool Contains(DataRow[] setA, DataRow b){
foreach(DataRow a in setA){
if (YourEquals(a,b)){
return true;
}
}
return false;
}