VB.Net what is the fastest way of storing and retrieving two values in memory

Hi Experts.   I have two threads.  The first runs through millions of lines of text looking for certain criteria.  When it finds what it is looking for, it takes two lines of text and stores them.  The second thread must then take the two lines of text and examine them further.
I am looking for the fastest way for the first thread to store them and for the second thread to access them.   There is no key/value situation necessary but the second thread must follow first in first out.   There may be as many as a few hundred thousand pairs of values waiting for the second thread.    Thoughts would be appreciated
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
>>I am looking for the fastest way for the first thread to store them and for the second thread to access them.

Use the queue class:
Add to the end (enqueue), signal the second thread there are items, in thread 2 remove oldest (dequeue)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
Also look at:
for a ConcurrentQueue.

Both links have details and example code.
PNRTAuthor Commented:
Thanks for the reply.   I looked at the queue but wondered about the fact that I was storing a pair of values.
String 1 and string 2.     I suppose I would join them and then split them to process them.  But would these actions not
make the entire process slower than another collection type?
Michael FowlerSolutions ConsultantCommented:
If using the queue just remember it is not threadsafe and so also have a look at the Synchronized Queue wrapper.
AndyAinscowFreelance programmer / ConsultantCommented:
    class Program
        static void Main(string[] args)
            Queue<foo> qf = new Queue<foo>();


    public class foo
        public string s1, s2;

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.