Set
The difference between a set and an array: a set can be discontinuous and multiple data types.
Value, address, and address of the next element
. Count count the number of elements in the Set
. Add () add element
. Addrange () adds a group of elements (such as an array)
. Remove () Remove the value in the first ()
. Removeat () removes an element according to the subscript in ().
. Insert (0th) insert an element at the position
. Insertrange (,) inserts a group of elements in position X.
. Clear () Clear the set
Position of the first occurrence of an element in. indexof () (-1 if no element exists)
Position of the last element in. lastindexof ()
Elements in the. Sort set are sorted in ascending order.
. Reverse () inversion
Int [] A = new int [5] {1, 2, 3, 4, 5 };
Foreach (INT n in a) // generally, foreach is used to traverse arrays and sets, which is efficient.
{
Console. writeline (N );
}
System. Threading. thread. Sleep (1000); // you can put it in the for statement to slow down the loop and reduce it by 1000 milliseconds.
Stack (Advanced and later)
Stack S = new stack ();
. Push () Push Value
. Pop-up value
. Clear () Clear
Team (first-in-first-out)
Queue q = new Queue ();
. Enqueue () into the value
. Dequeue () to retrieve the value
. Clear () Clear
Garbage collection:
The system enables garbage collection: 1. idle time and garbage collection; 2. When the memory usage is full, garbage collection is enabled.
Arraylist
140826 ● set