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

  • SEARCH
  • Home
  • 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 9109241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:59:46+00:00 2026-06-17T02:59:46+00:00

I am attempting to take two string collections and combine each line in both

  • 0

I am attempting to take two string collections and combine each line in both collections simultaneously to show a full file path for my user.

Examples to help clear up confusion:

  • String Collection 1 will contain a list of paths.
    Example:

    C:\windows\xxxx\xxx\xx, C:\Users\xxx\xxx, C:\test\xxx\xxx
    
  • String Collection 2 will contain a list of file names.
    Example:

    file.txt, asd.txt, mydll.dll
    

Each list holds the key to one another in the same line number and I just need to combine them to output them to the end user.

String Collection Line 1 + SC2 Line 1 = Path
SC Line 2 + SC2 Line 2 = Path
SC Line 3 + SC2 Line 3 = Path

The information is not accessible in a combined state so I will be placing the data into two separate WPF TextBoxes and then their content will be pulled into a stringcollection.

First Collection

StringCollection lines = new StringCollection();
int lineCount = filePath.LineCount;

for (int line = 0; line < lineCount; line++)
    // Get line text and add to string collection
    lines.Add(filePath.GetLineText(line));

Second Collection

StringCollection lines2 = new StringCollection();
int lineCount2 = fileName.LineCount;

for (int line = 0; line < lineCount; line++)
    // Get line text and add to string collection
    lines.Add(fileName.GetLineText(line));

Any and all help is appreciated!

Edit 1

I have experimented with the ZIP command thanks to Eve but I also found an alternate route. Is there a safer route using zip compared to the code below?

Keep in mind I will have a function to check the line counts and make sure they are the same.

        StringCollection lines = new StringCollection();
        int lineCount = itemIDBox.LineCount;

        for (int line = 0; line < lineCount; line++)
        {
            string id;
            string rev;
            string combined;

            id = itemIDBox.GetLineText(line);
            rev = revBox.GetLineText(line);

            combined = id + @"\" + rev;

            lines.Add(combined);
        }
  • 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-17T02:59:47+00:00Added an answer on June 17, 2026 at 2:59 am

    You can use the Zip method from System.Linq.

    var fullPaths = lines.Cast<string>().
        Zip(lines2.Cast<string>(), (path, fileName) => Path.Combine(path, fileName)).
        ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to take an NSImage and convert it to a string which I
Im attempting to take a string that is in a partial comma separated setup.
I am attempting to take in a text file with stock market tickers taken
I am attempting to take two-digit integers representing day-of-month, split the digits into single
Me and a colleague are starting a new project and attempting to take full
I'm attempting to take Excel 2003 and connect it to SQL Server 2000 to
Basically Im attempting to take a php / jquery / css / html web
I am attempting to find a way to take synthesized speech and record it
I'm attempting to find the euclidean distance in meters between two points on an
I am attempting to extract words as strings out of one very long string

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.