I am writing an application in C#. In this application I am getting data from different ports. Here I want to create a queue with the name equal to the portnumber whenever a new port starts sending data. Can I create such a queue?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you mean you want to create a queue of received data for each port that is being used, you’d be best having a keyed collection of queues. These queues would be keyed by the port number. So perhaps use a
Dictionary<int, Queue<Data>>. Then when a request comes in, you can check to see if the port already has a queue; if so, add to that queue; if not, create the queue. i.e.