System.Collections.Queue.Clone C# (CSharp) Method

Clone() public method

public Clone ( ) : Object
return Object
        public virtual Object Clone()
        {
            Queue q = new Queue(_size);
            q._size = _size;

            int numToCopy = _size;
            int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
            Array.Copy(_array, _head, q._array, 0, firstPart);
            numToCopy -= firstPart;
            if (numToCopy > 0)
                Array.Copy(_array, 0, q._array, _array.Length - _head, numToCopy);

            q._version = _version;
            return q;
        }

Same methods

Queue::Clone ( ) : object

Usage Example

Exemplo n.º 1
0
 static public int Clone(IntPtr l)
 {
     try {
         System.Collections.Queue self = (System.Collections.Queue)checkSelf(l);
         var ret = self.Clone();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of System.Collections.Queue::Clone