Skip to content
Justice Tech School

HashSet and Queue and Stack

HashSet keeps unique items. Queue is first in first out and Stack is last in first out.

Example
var s = new HashSet<int> { 1, 2, 2, 3 };
Console.WriteLine(s.Count);
var q = new Queue<int>(new[] { 1, 2 });
q.Enqueue(3);
Console.WriteLine(q.Dequeue());
var st = new Stack<int>(new[] { 1, 2 });
Console.WriteLine(st.Pop());

Exercise

Take from a queue.

q.()

Quiz Test

Stack order is?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.