Items - Add / Remove
Add
System.Collections.Generic.List<string> myList;
myList = new System.Collections.Generic.List<string>(3);
myList.Add("one");
myList.Add("two");
myList.Add("three");
myList.Add "four";
myList.Add(new object[] {"text",50,False)};
AddRange
add multiple elements
System.Collections.Generic.List<string> myList;
myList = new System.Collections.Generic.List<string>(3);
string sConCat;
sConCat = "one;two;three"
myList.AddRange(sConCat.Split(Ctype(";", Char)))
Insert a single element
Insert multiple elements
InsertRange
System.Collections.Generic.List<string> moreItems;
moreItems = new System.Collections.Generic.List<string>(4);
for (int i=0; i<moreItems.Count; i++)
{
moreItems[i] = 200;
}
myList.InsertRange(2, moreItems);
Removing
remove a single element
myList.Remove("two");
remove all elements based on a matching predicate
remove all
myList.Clear();
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext