How to work with “FIFO” in C# .NET?

2019-01-19 10:10发布

问题:

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

回答1:

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



回答2:

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



回答3:

Are you looking for the Queue<T> class?



标签: c# .net fifo