Description |
Count elements from the given (0 based) StartIndex position are removed from the ArrayList.
The element Count is decremented by Count.
|
| Notes | An exception is thrown if the range of values exceeds the 0 to Count-1 index elements in the ArrayList.
|
|
Microsoft MSDN Links |
System.Collections
System.Collections.ArrayList
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
uses
System.Collections;
var
List : System.Collections.ArrayList;
i : Integer;
begin
// Create our array list object
List := ArrayList.Create;
// Fill it with strings
List.Add('0.Zero');
List.Add('1.One');
List.Add('2.Two');
List.Add('3.Three');
List.Add('4.Four');
List.Add('5.Five');
List.Add('6.Six');
List.Add('7.Seven');
List.Add('8.Eight');
List.Add('9.Nine');
// Remove elements 5 to 7
Console.WriteLine('After removing elements 5 to 7 :');
Console.WriteLine;
List.RemoveRange(5, 3);
// Display the contents : note the 0 indexing
for i := 0 to List.Count-1 do
Console.WriteLine(List.Item[i]);
Console.Readline;
end.
| Show full unit code | After removing elements 5 to 7 :
0.Zero
1.One
2.Two
3.Three
4.Four
8.Eight
9.Nine
|
|
|
|