![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Priority Queues with C#
A priority queue is held information with a priority value. It is an extension of queue.
The item with the highest property is removed first when you try to eliminate an item from a priority queue.
Let us see how to set priority queue −
public class MyPriorityQueue <T> where T : IComparable <T> { }
Now let us add an item. In the below example the items get stored in info, which is a generic list.
Example
public class MyPriorityQueue <T> where T : IComparable <T> { private List <T> info; public MyPriorityQueue() { this.info = new List <T>(); } }
Advertisements