Axiom.Math.Collections.Vector3List.Insert C# (CSharp) Method

Insert() public method

Inserts an element into the Vector3List at the specified index.
/// is less than zero /// -or- /// is equal to or greater than . ///
public Insert ( int index, Vector3 item ) : void
index int The zero-based index at which should be inserted.
item Vector3 The to insert.
return void
        public virtual void Insert( int index, Vector3 item )
        {
            ValidateIndex( index, true ); // throws

            if ( m_count == m_array.Length )
                EnsureCapacity( m_count + 1 );

            if ( index < m_count )
            {
                Array.Copy( m_array, index, m_array, index + 1, m_count - index );
            }

            m_array[ index ] = item;
            m_count++;
            m_version++;
        }

Usage Example

 public override void Insert(int pos, Vector3 x)
 {
     lock (this.m_root)
         m_collection.Insert(pos, x);
 }