Results 1 to 4 of 4

Thread: [RESOLVED] [2005] FIFO arraylist

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    Resolved [RESOLVED] [2005] FIFO arraylist

    I need to add items to an arraylist until the count gets to, for example, 100 and then read them on a first in first out basis
    Last edited by T120; May 2nd, 2008 at 12:28 PM. Reason: Sorry - this is wrong and I don't know how ot delete it

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [RESOLVED] [2005] FIFO arraylist

    I see that you created this thread by misstake, but just for further reference, you should use a System.Collections.Generic.Queue(Of T).
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [RESOLVED] [2005] FIFO arraylist

    A queue would be the right way to go about it, but you could also use a List (of T), and just add to the end. You would then read from first to last. A queue will do more than that, because it will remove the first item each time such that the queue count will shrink each time you read it. That may be less desirable if you have any reason to maintain the list after the reading.
    My usual boring signature: Nothing

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [RESOLVED] [2005] FIFO arraylist

    I have posted examples of queues here.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width