using System; using System.Collections.Generic; Listnumbers = new List () { 1, 2, 3, 4, 5 }; numbers.RemoveAt(2); // Removes 3 from the list
using System; int[] array = new int[3] { 1, 2, 3 }; Array.RemoveAt(ref array, 1); // Removes 2 from the arrayIn both the examples above, we use the `RemoveAt` method to remove an item from the specified index. Package library: This method is a part of the System.Collections.Generic namespace for lists and the System namespace for arrays.