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

RemoveAt() public method

Removes the element at the specified index of the Vector3List.
/// is less than zero /// -or- /// is equal to or greater than . ///
public RemoveAt ( int index ) : void
index int The zero-based index of the element to remove.
return void
        public virtual void RemoveAt( int index )
        {
            ValidateIndex( index ); // throws

            m_count--;

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

            // We can't set the deleted entry equal to null, because it might be a value type.
            // Instead, we'll create an empty single-element array of the right type and copy it 
            // over the entry we want to erase.
            Vector3[] temp = new Vector3[ 1 ];
            Array.Copy( temp, 0, m_array, m_count, 1 );
            m_version++;
        }

Usage Example

 public override void RemoveAt(int pos)
 {
     lock (this.m_root)
         m_collection.RemoveAt(pos);
 }