diff options
Diffstat (limited to 'MediaBrowser.Providers/Manager/SimplePriorityQueue.cs')
| -rw-r--r-- | MediaBrowser.Providers/Manager/SimplePriorityQueue.cs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs index 879ae1dca..d064312cf 100644 --- a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs @@ -1,8 +1,6 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; namespace Priority_Queue { @@ -135,8 +133,7 @@ namespace Priority_Queue return false; } - SimpleNode node; - if (_queue.TryDequeue(out node)) + if (_queue.TryDequeue(out SimpleNode node)) { item = node.Data; return true; @@ -157,7 +154,7 @@ namespace Priority_Queue { lock (_queue) { - SimpleNode node = new SimpleNode(item); + var node = new SimpleNode(item); if (_queue.Count == _queue.MaxSize) { _queue.Resize(_queue.MaxSize * 2 + 1); @@ -167,9 +164,9 @@ namespace Priority_Queue } /// <summary> - /// Removes an item from the queue. The item does not need to be the head of the queue. + /// Removes an item from the queue. The item does not need to be the head of the queue. /// If the item is not in the queue, an exception is thrown. If unsure, check Contains() first. - /// If multiple copies of the item are enqueued, only the first one is removed. + /// If multiple copies of the item are enqueued, only the first one is removed. /// O(n) /// </summary> public void Remove(TItem item) @@ -213,7 +210,7 @@ namespace Priority_Queue public IEnumerator<TItem> GetEnumerator() { - List<TItem> queueData = new List<TItem>(); + var queueData = new List<TItem>(); lock (_queue) { //Copy to a separate list because we don't want to 'yield return' inside a lock @@ -247,4 +244,4 @@ namespace Priority_Queue /// </summary> /// <typeparam name="TItem">The type to enqueue</typeparam> public class SimplePriorityQueue<TItem> : SimplePriorityQueue<TItem, float> { } -}
\ No newline at end of file +} |
