Class QueueExtensions
- Namespace
- CarinaStudio.Collections
- Assembly
- CarinaStudio.AppBase.Core.dll
Extensions for Queue<T>.
public static class QueueExtensions
- Inheritance
-
QueueExtensions
- Inherited Members
Methods
IsEmpty<T>(Queue<T>)
Check whether the given queue is empty or not.
public static bool IsEmpty<T>(this Queue<T> queue)
Parameters
queue
Queue<T>Queue to check.
Returns
- bool
True if the queue is empty.
Type Parameters
T
Type of element of queue.
Remarks
The method is available for target framework before .NET 9.
IsNotEmpty<T>(Queue<T>?)
Check whether the given queue is not empty or not.
public static bool IsNotEmpty<T>(this Queue<T>? queue)
Parameters
queue
Queue<T>Queue to check.
Returns
- bool
True if the queue is not empty.
Type Parameters
T
Type of element of queue.
Remarks
The method is available for target framework before .NET 9.
IsNullOrEmpty<T>(Queue<T>?)
Check whether given queue is null/empty or not.
public static bool IsNullOrEmpty<T>(this Queue<T>? queue)
Parameters
queue
Queue<T>Queue to check.
Returns
- bool
True if the queue is null or empty.
Type Parameters
T
Type of element of queue.
Remarks
The method is available for target framework before .NET 9.
TryDequeue<T, TOut>(Queue<T>, out TOut)
Try dequeuing value from queue as given type.
public static bool TryDequeue<T, TOut>(this Queue<T> queue, out TOut value) where TOut : T
Parameters
Returns
- bool
True if value dequeued as given type successfully.
Type Parameters
T
Type of value in queue.
TOut
Desired type of value.
TryPeek<T, TOut>(Queue<T>, out TOut)
Try peeking value in queue as given type.
public static bool TryPeek<T, TOut>(this Queue<T> queue, out TOut value) where TOut : T
Parameters
Returns
- bool
True if value peeked as given type successfully.
Type Parameters
T
Type of value in queue.
TOut
Desired type of value.