Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 114207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:49:27+00:00 2026-05-11T02:49:27+00:00

Is there a relatively straightforward way to get the intersection of two DataTables in

  • 0

Is there a relatively straightforward way to get the intersection of two DataTables in .NET?

I can think of the obvious ways (iterating over both tables myself in O(n^2)), but I’d like something a little more elegant if it’s available. I suspect there may be an intelligent way that I’m not seeing. Readability and maintainability are important, of course, so I’m trying to stay away from anything too ‘slick’.

Any good ideas?

EDIT: It looks like Bryan Watts has a pretty great solution for 3.5, but unfortunately I’m in .NET 2.0 (which I should have mentioned.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:49:28+00:00Added an answer on May 11, 2026 at 2:49 am

    With .NET 3.5:

    using System.Data;  public static class DataTableExtensions {     public static IEnumerable<DataRow> Intersect(this DataTable table, DataTable other)     {         return table.AsEnumerable().Intersect(other.AsEnumerable());     }      public static IEnumerable<DataRow> Intersect(this DataTable table, DataTable other, IEqualityComparer<DataRow> comparer)     {         return table.AsEnumerable().Intersect(other.AsEnumerable(), comparer);     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a relatively secure way to store the password in the browser cookie
Are there any relatively simple to understand (and simple to implement) locality-sensitive hash examples
The needs of my company are quite simple : We have a multi-threaded .Net
I am under the impression that the best way to style a list item
I want to have three images in one row, and a Video or two
I have a requirement for implementing a data-store. Basically, I just need to be
I have a small portable tool which connects to around 150 servers at diverse
Okay, the title isn't very clear. Given a byte array (read from a database
I have several repositories for personal use and I back them up on my
(I did a search, and didn't see a duplicate. I apologize in advance if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.