System.Data.Tests.DataViewTest2.CompareSortedRowsByParentAndChildId C# (CSharp) Method

CompareSortedRowsByParentAndChildId() private method

private CompareSortedRowsByParentAndChildId ( DataView dv, DataRow drTable ) : bool
dv DataView
drTable DataRow
return bool
        private bool CompareSortedRowsByParentAndChildId(DataView dv, DataRow[] drTable)
        {
            if (dv.Count != drTable.Length) throw new Exception("DataRows[] length are different");

            //comparing the rows by using columns ParentId and ChildId
            for (int i = 0; i < dv.Count; i++)
            {
                if (dv[i].Row["ParentId"].ToString() != drTable[i]["ParentId"].ToString()
                    &&
                    dv[i].Row["ChildId"].ToString() != drTable[i]["ChildId"].ToString())
                    return false;
            }
            return true;
        }