/// <summary> /// returns and clears element a[top+offset] of the attribute stack /// </summary> /// <param name="offset">offset from top of stack, must be less or equal 0</param> /// <returns>a copy of the element a[top+offset] of the attribute stack</returns> public MultiTypeStruct PeekClear(Int32 offset) { Debug.Assert(offset <= 0 && offset >= -TopIndex, $"Argument of {nameof(PeekClear)} must be <=0"); MultiTypeStruct result = a[TopIndex + offset]; a[TopIndex + offset] = MultiTypeStructDefault; // clear all references contained in the element return(result); }
public StackOfMultiTypeElements(Int32 initialCapacity) { if (initialCapacity < 0) { throw new ArgumentOutOfRangeException(nameof(initialCapacity)); } a = new MultiTypeStruct[initialCapacity]; TopIndex = -1; // empty stack, no top element }