Rella
Rella

Reputation: 66955

How to work with "FIFO" in C# .NET?

Is there a standard collection in .NET that implements a FIFO stack?

Upvotes: 49

Views: 105320

Answers (3)

LukeH
LukeH

Reputation: 269428

Are you looking for the Queue<T> class?

Upvotes: 24

Dave Markle
Dave Markle

Reputation: 97701

FIFO means first-in-first-out. The data structure you're looking for is called a Queue.

Upvotes: 77

kemiller2002
kemiller2002

Reputation: 115498

FIFO means first in first out. This is as opposed to LIFO (or FILO as lucero pointed out). which is last in first out.

A link comparing queues, stacks, and hashtables.

You want to use a queue object for FIFO operations:

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=66

MSDN link on queues

And a stack is used for LIFO operations: Stack Link

Upvotes: 23

Related Questions