What is the method to add elements to a queue in C#?

In C#, you can add elements to a Queue using the Enqueue method. An example is shown below:

Queue<int> queue = new Queue<int>();
queue.Enqueue(10);
queue.Enqueue(20);
queue.Enqueue(30);

This example demonstrates the creation of a Queue object and adds three integer elements to the queue using the Enqueue method.

bannerAds