System.Collections.Stack.ToArray C# (CSharp) Method

ToArray() public method

public ToArray ( ) : object[]
return object[]
        public virtual object[] ToArray() { throw null; }
    }

Same methods

Stack::ToArray ( ) : Object[]

Usage Example

Exemplo n.º 1
0
        public void TestToArrayBasic()
        {
            Stack stk1;
            Object[] oArr;
            Int32 iNumberOfElements;
            String strValue;

            //[] Vanila test case - this gives an object array of the values in the stack
            stk1 = new Stack();
            oArr = stk1.ToArray();

            
            Assert.Equal(0, oArr.Length);

            iNumberOfElements = 10;
            for (int i = 0; i < iNumberOfElements; i++)
                stk1.Push(i);

            oArr = stk1.ToArray();
            Array.Sort(oArr);

            for (int i = 0; i < oArr.Length; i++)
            {
                strValue = "Value_" + i;
                
            Assert.Equal((Int32)oArr[i], i);
            }
        }
All Usage Examples Of System.Collections.Stack::ToArray