TokenList (Class)

A base class for manipulating a comma-separated list of string values as a collection of items.  

Any text or item added, updated, or inserted that contains commas will have separate items added to the item collection. Duplicate values may be added.

MyTokenList.Add("Symbol1"); // adds the first string value as item 0

MyTokenList.Add("Symbol2"); // adds the second string value as item 1

MyTokenList.Insert(0,"Symbol3"); // inserts a new string value at item 0

MyList=MyTokenList.Value; // MyList contains the comma-delimited string values "Symbol1,Symbol3,Symbol2"

RemoveAt(0); // deletes the first item in the list

MyString=Item[0]; // MyString will contain the string value for the first item which is now "Symbol3"

Note: It may be a good practice to force all text used with the TokenList to be either upper or lower case.

Namespace: tsdata.common

Properties

   Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).

  Name Type Description
Public property Count int Gets the number of items contained in the list.
Public property IsReadOnly bool True indicates that the list is read-only.
Public property Item[index] string Gets or sets the value of the string item with the specified index.
Public property Value string Gets or sets the string containing the full list of comma-separated string items.
Methods
  Name Description
Public property Add(name) Adds an item with the provided string value (name) to the list.
Public property Clear Removes all items from the list.
Public property Clone Creates a copy of the current instance.
Public property Contains(name) True if the list contains an item with the specified string value (name).
Public property Create Initializes a new instance of the class.
Public property Create(values) Initializes a new instance of the class using the specified comma-delimited list of values.
Public property IndexOf(name) Get the index of the list item with the specified string value (name).
Public property Insert(index,name) Inserts a string value (name) at the specified index position.
Public property Remove(name) Removes the first occurrence of a specified string value (name) from the list.
Public property RemoveAt(index) Removes a string value item from the list at a specified index position.
Public property ToString(string) Gets the full list of string values as a comma-delimited string.
Operators
  Name Description

operator +=

Adds an string value item to the list.
operator -= Removes the specified string value item from the list.
Inheritance Hierarchy

elsystem.Object

tsdata.common.TokenList