title: Simple priority queue in C# - what will be better than List with custom Sorter : IComparer?
body: <p>I would like to implement a priority queue which would inject my objects - <code>Nodes</code> to the queue with respect to one field - <code>f</code>. I have already written List with custom comparer but this would require from me to: </p>
  
  <ul>
  <li>enqueue - sort the List after each insertion</li>
  <li><p>dequeue - remove the last(instead of first for performance) like so</p>
  
  <pre><code>myList.RemoveAt(myList.Count - 1);
  </code></pre></li>
  </ul>
  
  <p>My List should be always sorted according to some field (here I need it to be sorted by <code>f</code>). I also need the ability to add and <code>dequeue</code> the object with lowest value from the list.</p>
  
  <p>Can someone tell me what would be the best approach to this ? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p><a href="https://stackoverflow.com/users/335858/dasblinkenlight">dasblinkenlight</a> has a very good answer but just I have realised that I should be able to store duplicates in this container.</p>