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 9232921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:25:41+00:00 2026-06-18T06:25:41+00:00

I parse in a file and save the results to a list in C#.

  • 0

I parse in a file and save the results to a list in C#. I then parse all results of a DB query to another list. I want to compare the two lists for matches and save the results to another list to write an output file. I thought comparing the two lists was faster and better than running the query against the DB each time for each person since their is about 16k records in the file.

List 1. List fileList contains datatypes of: string personsName

List 2. List DBresults contains datatypes of: string personsName, string address, string phoneNumber

Trying to compare List 1 to List 2 to find matches and then send results to another list to write output.
Their could be multiple results per person in List 2 so I need to find every instance.

Started with a LINQ query like this but I’m no master at LINQ so I need some help.

var matches = fileList.Where(a=>a.personsName == DBResults.where(s=>s,personsName).toList();

I’m also open to other suggestions if you think you may have a faster way. I know IDctionarys and Hashtables are fast look up tables but I have three datatypes so I can’t do a keyvaluepair.

  • 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. Editorial Team
    Editorial Team
    2026-06-18T06:25:43+00:00Added an answer on June 18, 2026 at 6:25 am

    If I understand correctly your problem, the solution is the LINQ Join method.

    var result = (from a in fileList
                  join s in DBResults on a.personsName equals s.personsName
                  select s).ToList();
    

    Or using the extension method syntax:

    var result = fileList.Join(DBResults, a => a.personsName, s => s.personsName, (a, s) => s).ToList();
    

    This method is extremely fast and internally uses HashSet to improve performances.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to parse file paths like this one: /var/www/index.(htm|html|php|shtml) into
I want to parse xml file in utf-8 and sort it by some field.
I'm trying to match specific terms on a XML file and save the results.
This is part of a ruby script. I want to save the results to
I create my pdf document out of a html File. I want to save
I retrieve XML from a server, save it into an SD card, then parse
I want to parse a text file to get what I want and create
I need parse my XML file and save parsed XML to SQL database. My
I parse xml file in android. I copypasted example... It works with english words,
I try to parse a file in my DatabaseHandler class but Eclipse say: The

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.