I want to make sure that 2 Ado.net datatables have the same schema: number of columns + col types etc. How can this be done?
Lets say I have variables: Datatable A and Datatable B. How can I compare to see if the schema of A is same as Schema of B
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know of any built in way to compare DataTables and without having defined a complete specification (and you always should) its likely that I’m going to miss some case you care about.
That said the following does manage to compare two DataTables and determine if the following is true
It’s using an Extension Method and implements IEqualityComparer to make the comparison.
Test Cases
Extension Method
Implementation of IEqualityComparer
Output