Class NetworkQueue<T>
- Namespace
- Netick
- Assembly
- Netick.dll
A networked Queue<T> collection.
public sealed class NetworkQueue<T> : NetworkQueue, INetworkCollection, IEnumerable<T>, IEnumerable where T : unmanaged
Type Parameters
T
- Inheritance
-
NetworkQueue<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Constructors
NetworkQueue(int)
public NetworkQueue(int capacity)
Parameters
capacityint
Properties
Count
Gets the number of elements contained in the queue.
public int Count { get; }
Property Value
Methods
Add(T)
Adds an item to the underlying original queue. Used for local operations.
public void Add(T item)
Parameters
itemTThe item to add.
Clear()
Removes all elements from the queue.
public void Clear()
Dequeue()
Removes and returns the item at the beginning of the queue.
public T Dequeue()
Returns
- T
The item removed from the beginning of the queue.
Exceptions
- InvalidOperationException
Thrown if the queue is empty.
Enqueue(T)
Adds an item to the end of the queue if there is capacity.
public bool Enqueue(T item)
Parameters
itemTThe item to add.
Returns
- bool
trueif the item was added; otherwise,falseif the queue is full.
GetEnumerator()
public NetworkQueue<T>.Enumerator GetEnumerator()
Returns
InternalInit(INetickNetworkScript, int*, int, int)
public override void InternalInit(INetickNetworkScript beh, int* state, int elementSizeWords, int flags)
Parameters
behINetickNetworkScriptstateint*elementSizeWordsintflagsint
InternalReset()
public override void InternalReset()
Peek()
Returns the item at the beginning of the queue without removing it.
public T Peek()
Returns
- T
The item at the beginning of the queue.
Exceptions
- InvalidOperationException
Thrown if the queue is empty.
TryDequeue(out T)
Attempts to remove and return the item at the beginning of the queue.
public bool TryDequeue(out T result)
Parameters
resultTWhen this method returns, contains the object removed from the queue, or the default value if the queue is empty.
Returns
- bool
trueif an item was dequeued; otherwise,false.
TryPeek(out T)
Attempts to return the item at the beginning of the queue without removing it.
public bool TryPeek(out T result)
Parameters
resultTWhen this method returns, contains the object at the beginning of the queue, or the default value if the queue is empty.
Returns
- bool
trueif an item was found; otherwise,false.