You can initialize a list with preset values:
List<int> L1 = new List<int> {1, 2, 3};
is there an equivalent above for the queue? My idea:
Queue<int> Q1 = new Queue<int> {1, 2, 3};
which does not work. Is there any workaround?
Is an
Queue<int> Q1 = new Queue<int>(); Q1.Enqueue(1); Q1.Enqueue(2); Q1.Enqueue(3);
the only acceptable solution?
thkang
source share