Class NetworkStack<T>
- Namespace
- Netick
- Assembly
- Netick.dll
A networked Stack<T> collection.
public sealed class NetworkStack<T> : NetworkStack, INetworkCollection, IEnumerable<T>, IEnumerable where T : unmanaged
Type Parameters
T
- Inheritance
-
NetworkStack<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Constructors
NetworkStack(int)
public NetworkStack(int capacity)
Parameters
capacityint
Properties
Count
Gets the number of items contained in the stack.
public int Count { get; }
Property Value
Methods
Add(T)
Adds an item to the original stack (used for internal state).
public void Add(T item)
Parameters
itemTThe element to add.
Clear()
Removes all items from the stack.
public void Clear()
GetEnumerator()
public NetworkStack<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 top of the stack without removing it.
public T Peek()
Returns
- T
The item at the top of the stack, or default if the stack is empty.
Pop()
Removes and returns the item at the top of the stack.
public T Pop()
Returns
- T
The item removed from the top of the stack, or default if the stack is empty.
Push(T)
Pushes an item onto the top of the stack.
public bool Push(T item)
Parameters
itemTThe item to push onto the stack.
Returns
- bool
True if the item was pushed; false if the stack is full.
TryPeek(out T)
Attempts to return the item at the top of the stack without removing it.
public bool TryPeek(out T result)
Parameters
resultTThe item at the top of the stack, or default if the stack is empty.
Returns
- bool
True if an item was returned; otherwise, false.
TryPop(out T)
Attempts to remove and return the item at the top of the stack.
public bool TryPop(out T result)
Parameters
resultTThe item removed from the top of the stack, or default if the stack is empty.
Returns
- bool
True if an item was removed; otherwise, false.